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
- AppDomainFactory.cs
- ProviderCollection.cs
- TrackingMemoryStream.cs
- DataSourceXmlClassAttribute.cs
- ResourceReferenceKeyNotFoundException.cs
- ToolStripSplitStackLayout.cs
- Size3DConverter.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- CommandConverter.cs
- RC2.cs
- CommandPlan.cs
- GridSplitter.cs
- CharConverter.cs
- ValidatingReaderNodeData.cs
- WebConvert.cs
- UIElement3D.cs
- TypeKeyValue.cs
- StateBag.cs
- View.cs
- RectIndependentAnimationStorage.cs
- AppendHelper.cs
- DesignBindingConverter.cs
- TrackingServices.cs
- UpdateCompiler.cs
- XPathDescendantIterator.cs
- NodeFunctions.cs
- CompilerGlobalScopeAttribute.cs
- CutCopyPasteHelper.cs
- ZipIOModeEnforcingStream.cs
- ListViewHitTestInfo.cs
- ExpandSegmentCollection.cs
- HashAlgorithm.cs
- DetailsViewCommandEventArgs.cs
- WindowProviderWrapper.cs
- SchemaElementLookUpTable.cs
- ReadOnlyDataSourceView.cs
- COM2EnumConverter.cs
- SelectManyQueryOperator.cs
- recordstate.cs
- TabletDeviceInfo.cs
- CommonXSendMessage.cs
- ObjectQueryExecutionPlan.cs
- StringAnimationUsingKeyFrames.cs
- ReflectionPermission.cs
- DataGridViewCell.cs
- PlainXmlSerializer.cs
- LineBreakRecord.cs
- XmlSchemaSequence.cs
- NotifyCollectionChangedEventArgs.cs
- ExtractorMetadata.cs
- Token.cs
- SemanticTag.cs
- RtfToken.cs
- SemanticResultKey.cs
- BinaryFormatterWriter.cs
- Automation.cs
- DispatcherHooks.cs
- SslStreamSecurityBindingElement.cs
- XmlTextReaderImpl.cs
- Point.cs
- XmlDataImplementation.cs
- MultiTargetingUtil.cs
- VirtualPathUtility.cs
- figurelength.cs
- BitmapCodecInfo.cs
- TimeSpanConverter.cs
- ProcessHostFactoryHelper.cs
- BaseDataListComponentEditor.cs
- CompiledXpathExpr.cs
- Pens.cs
- BadImageFormatException.cs
- DBDataPermission.cs
- ManualResetEvent.cs
- __ComObject.cs
- Package.cs
- GraphicsPathIterator.cs
- CommentEmitter.cs
- RichTextBox.cs
- ListControl.cs
- DBCommandBuilder.cs
- DataGridRowHeader.cs
- ComponentEditorForm.cs
- SystemIPv4InterfaceProperties.cs
- DataGridRowDetailsEventArgs.cs
- ColorConvertedBitmapExtension.cs
- SchemaCollectionCompiler.cs
- TcpTransportSecurityElement.cs
- ConfigurationSettings.cs
- ProvidePropertyAttribute.cs
- DateTimeOffsetConverter.cs
- WebPartUserCapability.cs
- DesignerRegionCollection.cs
- RectangleGeometry.cs
- MenuCommandService.cs
- FrameSecurityDescriptor.cs
- NameTable.cs
- ObjectQuery.cs
- AnimationStorage.cs
- WCFModelStrings.Designer.cs
- MexHttpBindingCollectionElement.cs