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
- NodeLabelEditEvent.cs
- Rect3DConverter.cs
- namescope.cs
- PopupRoot.cs
- HtmlMeta.cs
- DataReaderContainer.cs
- ContractCodeDomInfo.cs
- DateTimeValueSerializer.cs
- SqlDuplicator.cs
- ExpandableObjectConverter.cs
- MessageSecurityOverHttp.cs
- Effect.cs
- Geometry3D.cs
- SqlMethodCallConverter.cs
- DataMisalignedException.cs
- QueueProcessor.cs
- XamlInt32CollectionSerializer.cs
- TreeView.cs
- NameValueConfigurationElement.cs
- SerializationHelper.cs
- StringToken.cs
- ApplicationHost.cs
- ClientUtils.cs
- ConfigurationValue.cs
- RequestDescription.cs
- CommandPlan.cs
- XmlUrlResolver.cs
- GroupPartitionExpr.cs
- DesignerAdapterAttribute.cs
- TitleStyle.cs
- ConfigurationPropertyAttribute.cs
- MetadataItem.cs
- RegexRunner.cs
- BaseTemplateCodeDomTreeGenerator.cs
- EntityException.cs
- CollectionEditVerbManager.cs
- CategoryEditor.cs
- ProxyWebPartManager.cs
- TreeNode.cs
- WindowsFormsLinkLabel.cs
- MenuItemBindingCollection.cs
- FeatureAttribute.cs
- WebServiceEnumData.cs
- PrimaryKeyTypeConverter.cs
- Frame.cs
- CollectionConverter.cs
- ArrayEditor.cs
- HuffCodec.cs
- NavigationService.cs
- CreationContext.cs
- Geometry.cs
- ThicknessAnimationBase.cs
- SoundPlayer.cs
- XPathParser.cs
- DefaultPrintController.cs
- DataGridPagingPage.cs
- LinqDataSourceInsertEventArgs.cs
- ToolStripOverflow.cs
- ChannelTokenTypeConverter.cs
- EndEvent.cs
- IDReferencePropertyAttribute.cs
- LongValidatorAttribute.cs
- ExpressionEditorSheet.cs
- CompositeActivityMarkupSerializer.cs
- BindingMAnagerBase.cs
- XNodeValidator.cs
- ReliabilityContractAttribute.cs
- ObjectItemLoadingSessionData.cs
- InternalConfigEventArgs.cs
- MenuRendererClassic.cs
- _BufferOffsetSize.cs
- DetailsViewCommandEventArgs.cs
- GroupBoxRenderer.cs
- ObjectStorage.cs
- PropertyGridCommands.cs
- MouseWheelEventArgs.cs
- TextElementEditingBehaviorAttribute.cs
- SchemaElement.cs
- RelationshipEnd.cs
- SQLGuidStorage.cs
- Int64Animation.cs
- CallTemplateAction.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- NotFiniteNumberException.cs
- Translator.cs
- CodeDelegateCreateExpression.cs
- GroupedContextMenuStrip.cs
- SchemaObjectWriter.cs
- DPTypeDescriptorContext.cs
- MethodRental.cs
- ItemCollection.cs
- MemoryFailPoint.cs
- SmiSettersStream.cs
- SchemaElementDecl.cs
- EmptyEnumerable.cs
- ContainerActivationHelper.cs
- HyperLinkStyle.cs
- QueryCacheManager.cs
- GlobalProxySelection.cs
- ComponentEditorForm.cs