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
- XmlSchemaNotation.cs
- unsafenativemethodsother.cs
- EventWaitHandleSecurity.cs
- ContentElementAutomationPeer.cs
- ValueTable.cs
- Typography.cs
- FrameworkTemplate.cs
- DocumentViewerAutomationPeer.cs
- DynamicField.cs
- QilExpression.cs
- PropertyDescriptor.cs
- WebServiceData.cs
- BrowserCapabilitiesFactoryBase.cs
- SqlPersistenceProviderFactory.cs
- MessagingActivityHelper.cs
- LineVisual.cs
- _ListenerAsyncResult.cs
- WindowsMenu.cs
- TdsParserStaticMethods.cs
- PlatformCulture.cs
- EntityDataSourceReferenceGroup.cs
- XmlSchemaException.cs
- DocumentSequence.cs
- SerializationInfoEnumerator.cs
- SpeechRecognitionEngine.cs
- HMACSHA256.cs
- GatewayDefinition.cs
- TimeSpanConverter.cs
- Subtree.cs
- SpeechSeg.cs
- ListViewTableCell.cs
- XmlUtil.cs
- SqlDataReader.cs
- ToolStripPanelCell.cs
- ExpandedProjectionNode.cs
- AncillaryOps.cs
- BinaryObjectReader.cs
- GlyphsSerializer.cs
- XmlSchemaComplexContentRestriction.cs
- DataExpression.cs
- KeyedHashAlgorithm.cs
- ProfileBuildProvider.cs
- SQLBytesStorage.cs
- CommonXSendMessage.cs
- TabControl.cs
- PagedDataSource.cs
- SystemKeyConverter.cs
- Attributes.cs
- ModifierKeysConverter.cs
- CalendarDesigner.cs
- LicenseManager.cs
- UrlMappingsModule.cs
- DetailsViewModeEventArgs.cs
- StreamGeometry.cs
- DecoderFallback.cs
- HelpEvent.cs
- FixedSOMLineCollection.cs
- WsdlBuildProvider.cs
- clipboard.cs
- ItemAutomationPeer.cs
- securestring.cs
- PageParserFilter.cs
- ByteStorage.cs
- ScriptManager.cs
- NeedSkipTokenVisitor.cs
- WebPartMenu.cs
- FileBasedResourceGroveler.cs
- TextSpanModifier.cs
- Int32EqualityComparer.cs
- BooleanConverter.cs
- SafeSecurityHandles.cs
- ConfigurationConverterBase.cs
- BaseTreeIterator.cs
- BitSet.cs
- HttpWriter.cs
- ListSortDescriptionCollection.cs
- HitTestResult.cs
- CacheOutputQuery.cs
- FrameworkContentElement.cs
- HttpProxyTransportBindingElement.cs
- Style.cs
- TableDetailsCollection.cs
- RTLAwareMessageBox.cs
- MembershipPasswordException.cs
- InertiaExpansionBehavior.cs
- ValidationPropertyAttribute.cs
- CrossContextChannel.cs
- DocobjHost.cs
- BlurBitmapEffect.cs
- XmlLoader.cs
- BuildProviderCollection.cs
- MetadataSection.cs
- ObjectResult.cs
- Comparer.cs
- CompoundFileStorageReference.cs
- RequestStatusBarUpdateEventArgs.cs
- EventInfo.cs
- DataContractSerializerMessageContractImporter.cs
- NamespaceEmitter.cs
- XmlILConstructAnalyzer.cs