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
- DynamicDiscoveryDocument.cs
- OrthographicCamera.cs
- OleDbCommand.cs
- PersistenceTypeAttribute.cs
- AppDomainAttributes.cs
- DocumentsTrace.cs
- RenderData.cs
- TraceData.cs
- StickyNote.cs
- ReadOnlyState.cs
- MailMessageEventArgs.cs
- QueueNameHelper.cs
- SimpleWorkerRequest.cs
- GeometryCombineModeValidation.cs
- DesignerCalendarAdapter.cs
- SimpleExpression.cs
- DoubleAnimationUsingPath.cs
- PenContexts.cs
- SeparatorAutomationPeer.cs
- _FtpDataStream.cs
- RoleManagerSection.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- XmlCDATASection.cs
- DataGridViewHitTestInfo.cs
- ParseHttpDate.cs
- StrokeDescriptor.cs
- ObjectAnimationUsingKeyFrames.cs
- ProfileGroupSettings.cs
- WebPartMinimizeVerb.cs
- DesignerActionPropertyItem.cs
- FeatureAttribute.cs
- GestureRecognitionResult.cs
- HuffModule.cs
- CodeCastExpression.cs
- ControlCollection.cs
- MatrixIndependentAnimationStorage.cs
- PngBitmapDecoder.cs
- CheckPair.cs
- IsolatedStorageFilePermission.cs
- _ChunkParse.cs
- StringUtil.cs
- ProgressBar.cs
- SubordinateTransaction.cs
- Compress.cs
- HideDisabledControlAdapter.cs
- InvalidOleVariantTypeException.cs
- SqlCaseSimplifier.cs
- TabItem.cs
- ChannelDispatcher.cs
- EncoderFallback.cs
- ArraySortHelper.cs
- DXD.cs
- XNodeNavigator.cs
- SocketElement.cs
- XPathNodeList.cs
- DbgCompiler.cs
- PropertyInfo.cs
- XmlNodeChangedEventArgs.cs
- HtmlLabelAdapter.cs
- ImageMap.cs
- WebControlsSection.cs
- X509CertificateEndpointIdentity.cs
- SeparatorAutomationPeer.cs
- ContentIterators.cs
- XappLauncher.cs
- TCEAdapterGenerator.cs
- TreeBuilder.cs
- CryptoApi.cs
- x509utils.cs
- ObjectContext.cs
- ExtensionSimplifierMarkupObject.cs
- ElementNotAvailableException.cs
- NameSpaceEvent.cs
- Part.cs
- EventEntry.cs
- RawStylusInputCustomData.cs
- WpfPayload.cs
- HotSpotCollectionEditor.cs
- ObjectQuery.cs
- DropAnimation.xaml.cs
- TableItemPattern.cs
- XmlILTrace.cs
- IriParsingElement.cs
- Item.cs
- Menu.cs
- AddressAccessDeniedException.cs
- NameObjectCollectionBase.cs
- InteropExecutor.cs
- complextypematerializer.cs
- EventLogInternal.cs
- filewebrequest.cs
- TextServicesCompartmentEventSink.cs
- RangeValidator.cs
- QilReference.cs
- CustomCredentialPolicy.cs
- StateFinalizationDesigner.cs
- ArithmeticException.cs
- AspNetSynchronizationContext.cs
- SelectionProviderWrapper.cs
- Button.cs