Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Serializer / XmlDocumentSurrogate.cs / 1305376 / XmlDocumentSurrogate.cs
namespace System.Workflow.ComponentModel.Serialization { using System; using System.Xml; using System.Runtime.Serialization; using System.Reflection; using System.IO; using System.Runtime.Serialization.Formatters.Binary; #region XmlDocumentSurrogate internal sealed class XmlDocumentSurrogate : ISerializationSurrogate { internal XmlDocumentSurrogate() {} void ISerializationSurrogate.GetObjectData(object obj, SerializationInfo info, StreamingContext context) { XmlDocument doc = obj as XmlDocument; if (doc == null) throw new ArgumentException(SR.GetString(SR.Error_InvalidArgumentValue), "obj"); info.AddValue("innerXml", doc.InnerXml); info.SetType(typeof(XmlDocumentReference)); } object ISerializationSurrogate.SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { return null; } #region XmlDocumentReference [Serializable] private sealed class XmlDocumentReference : IObjectReference { private string innerXml = string.Empty; Object IObjectReference.GetRealObject(StreamingContext context) { XmlDocument doc = new XmlDocument(); if (!string.IsNullOrEmpty(this.innerXml)) doc.InnerXml = this.innerXml; return doc; } } #endregion } #endregion } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Workflow.ComponentModel.Serialization { using System; using System.Xml; using System.Runtime.Serialization; using System.Reflection; using System.IO; using System.Runtime.Serialization.Formatters.Binary; #region XmlDocumentSurrogate internal sealed class XmlDocumentSurrogate : ISerializationSurrogate { internal XmlDocumentSurrogate() {} void ISerializationSurrogate.GetObjectData(object obj, SerializationInfo info, StreamingContext context) { XmlDocument doc = obj as XmlDocument; if (doc == null) throw new ArgumentException(SR.GetString(SR.Error_InvalidArgumentValue), "obj"); info.AddValue("innerXml", doc.InnerXml); info.SetType(typeof(XmlDocumentReference)); } object ISerializationSurrogate.SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { return null; } #region XmlDocumentReference [Serializable] private sealed class XmlDocumentReference : IObjectReference { private string innerXml = string.Empty; Object IObjectReference.GetRealObject(StreamingContext context) { XmlDocument doc = new XmlDocument(); if (!string.IsNullOrEmpty(this.innerXml)) doc.InnerXml = this.innerXml; return doc; } } #endregion } #endregion } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SQlBooleanStorage.cs
- WorkflowRuntimeElement.cs
- XmlSchemaAny.cs
- SharedPersonalizationStateInfo.cs
- WebPartCatalogAddVerb.cs
- HashSet.cs
- RectAnimation.cs
- MergablePropertyAttribute.cs
- StringArrayConverter.cs
- RepeaterItemEventArgs.cs
- AsyncContentLoadedEventArgs.cs
- QueryContinueDragEventArgs.cs
- VarInfo.cs
- DataTrigger.cs
- StrongNamePublicKeyBlob.cs
- DiscoveryInnerClientManaged11.cs
- NumberFormatInfo.cs
- FunctionImportElement.cs
- ContextMenuStrip.cs
- FormattedText.cs
- MemberNameValidator.cs
- WindowsImpersonationContext.cs
- SynchronizedDispatch.cs
- MaskInputRejectedEventArgs.cs
- ColumnHeader.cs
- Registry.cs
- ResourceDisplayNameAttribute.cs
- DBConnection.cs
- IgnoreSection.cs
- datacache.cs
- StringAnimationBase.cs
- DataGridTextBox.cs
- ObjectHelper.cs
- BitmapData.cs
- WebPartCollection.cs
- TaskFileService.cs
- CustomBindingElement.cs
- GenericWebPart.cs
- BamlMapTable.cs
- CaseKeyBox.ViewModel.cs
- Serialization.cs
- GenericTypeParameterBuilder.cs
- DataControlFieldHeaderCell.cs
- LocationUpdates.cs
- XmlCDATASection.cs
- ReaderWriterLockSlim.cs
- PopupControlService.cs
- RemoteWebConfigurationHost.cs
- ServicePointManager.cs
- EnvelopedPkcs7.cs
- PrintingPermission.cs
- DataServiceProcessingPipeline.cs
- Selector.cs
- WebPartAddingEventArgs.cs
- CleanUpVirtualizedItemEventArgs.cs
- ScriptRegistrationManager.cs
- DrawingServices.cs
- SqlBuilder.cs
- TraceFilter.cs
- BindingListCollectionView.cs
- StringResourceManager.cs
- IdSpace.cs
- Size3DValueSerializer.cs
- ListItemParagraph.cs
- BehaviorEditorPart.cs
- SortedList.cs
- UrlParameterWriter.cs
- SerializationEventsCache.cs
- OpacityConverter.cs
- OleDbRowUpdatedEvent.cs
- SetterTriggerConditionValueConverter.cs
- PrintPreviewControl.cs
- SimpleNameService.cs
- HandlerElement.cs
- WebServiceEnumData.cs
- HMACSHA1.cs
- WebBrowserUriTypeConverter.cs
- ListSortDescription.cs
- MenuItem.cs
- filewebresponse.cs
- DeclaredTypeValidator.cs
- QuaternionAnimationBase.cs
- WebPartConnectionsConnectVerb.cs
- VisualStateChangedEventArgs.cs
- XsltLibrary.cs
- Speller.cs
- ByteConverter.cs
- ConfigurationConverterBase.cs
- InternalEnumValidatorAttribute.cs
- DataExchangeServiceBinder.cs
- CacheOutputQuery.cs
- Filter.cs
- SmiTypedGetterSetter.cs
- Decorator.cs
- MaskInputRejectedEventArgs.cs
- CmsInterop.cs
- InkCanvasSelectionAdorner.cs
- PermissionRequestEvidence.cs
- TemplateControlCodeDomTreeGenerator.cs
- LoginStatusDesigner.cs