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
- XmlTypeAttribute.cs
- SqlFacetAttribute.cs
- CompilerWrapper.cs
- XmlDictionaryString.cs
- ChangeInterceptorAttribute.cs
- DataSourceView.cs
- SQLBytesStorage.cs
- ping.cs
- NameValuePair.cs
- SafeFileHandle.cs
- RightsManagementEncryptionTransform.cs
- XmlChildEnumerator.cs
- AttributeExtensions.cs
- DataGridToolTip.cs
- MessageHeaderDescriptionCollection.cs
- FocusTracker.cs
- ObjectToken.cs
- DependencyProperty.cs
- DataControlPagerLinkButton.cs
- EncodingTable.cs
- BufferedWebEventProvider.cs
- BitArray.cs
- TransformerInfo.cs
- SqlDataReaderSmi.cs
- InvalidateEvent.cs
- FramingChannels.cs
- ScriptMethodAttribute.cs
- PTUtility.cs
- ConnectionInterfaceCollection.cs
- HTMLTagNameToTypeMapper.cs
- XmlUrlResolver.cs
- NamedPipeTransportManager.cs
- MethodBuilderInstantiation.cs
- FloatUtil.cs
- ComponentEditorPage.cs
- SQLCharsStorage.cs
- Region.cs
- SafeHandles.cs
- JumpPath.cs
- HtmlTernaryTree.cs
- QueryResults.cs
- figurelength.cs
- MethodAccessException.cs
- OpCodes.cs
- SlipBehavior.cs
- SplitterDesigner.cs
- DataChangedEventManager.cs
- JobDuplex.cs
- ButtonStandardAdapter.cs
- DataGridViewTextBoxEditingControl.cs
- EntityCommandExecutionException.cs
- BaseTemplateParser.cs
- HorizontalAlignConverter.cs
- CalculatedColumn.cs
- DataGridViewAccessibleObject.cs
- CommandValueSerializer.cs
- ContainerControl.cs
- SoapHeader.cs
- ComponentResourceManager.cs
- AudioLevelUpdatedEventArgs.cs
- EncoderNLS.cs
- OracleFactory.cs
- DynamicRenderer.cs
- ListControlStringCollectionEditor.cs
- DesigntimeLicenseContext.cs
- ModuleConfigurationInfo.cs
- ErasingStroke.cs
- SubMenuStyleCollection.cs
- ManipulationPivot.cs
- ManifestResourceInfo.cs
- ValidationSummary.cs
- BamlResourceContent.cs
- HttpResponseWrapper.cs
- ValueQuery.cs
- FixedTextView.cs
- FormViewPagerRow.cs
- FlowDecision.cs
- StructuredType.cs
- WebPartTransformer.cs
- XmlDataCollection.cs
- ImageMapEventArgs.cs
- ValueTypeFixupInfo.cs
- TextTreeObjectNode.cs
- SafeCertificateContext.cs
- HttpRequest.cs
- DependencyPropertyKey.cs
- Italic.cs
- ServiceMetadataPublishingElement.cs
- TextRangeBase.cs
- PipeStream.cs
- ValidationResult.cs
- OrderByQueryOptionExpression.cs
- FixUpCollection.cs
- _LocalDataStoreMgr.cs
- DeclarativeCatalogPartDesigner.cs
- XamlSerializer.cs
- ListManagerBindingsCollection.cs
- Lazy.cs
- PlatformCulture.cs
- Profiler.cs