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
- ActiveDesignSurfaceEvent.cs
- PointLightBase.cs
- MenuAdapter.cs
- GridProviderWrapper.cs
- XmlSerializerNamespaces.cs
- DbBuffer.cs
- SystemException.cs
- Rect3D.cs
- AnimationClock.cs
- RelationshipNavigation.cs
- BevelBitmapEffect.cs
- EncryptedKey.cs
- PathTooLongException.cs
- RichListBox.cs
- WindowsSpinner.cs
- ImageField.cs
- DataBindingHandlerAttribute.cs
- FullTextBreakpoint.cs
- BatchParser.cs
- DBSqlParserColumnCollection.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- CngProvider.cs
- XmlQuerySequence.cs
- X509Certificate2.cs
- DispatchWrapper.cs
- DataListComponentEditor.cs
- EFColumnProvider.cs
- AudioStateChangedEventArgs.cs
- WindowsScroll.cs
- TimeSpanValidatorAttribute.cs
- MultilineStringEditor.cs
- TrustExchangeException.cs
- SessionStateModule.cs
- MergeFilterQuery.cs
- ReflectionPermission.cs
- BaseValidator.cs
- TemplateControlCodeDomTreeGenerator.cs
- ElementInit.cs
- MD5CryptoServiceProvider.cs
- TextBoxAutoCompleteSourceConverter.cs
- WindowsTitleBar.cs
- DiffuseMaterial.cs
- TakeOrSkipWhileQueryOperator.cs
- ClientProtocol.cs
- SoapAttributes.cs
- FtpWebRequest.cs
- VisualStateGroup.cs
- PerfCounterSection.cs
- securitycriticaldataformultiplegetandset.cs
- _Semaphore.cs
- RowToParametersTransformer.cs
- ForwardPositionQuery.cs
- RegistryPermission.cs
- DataMemberConverter.cs
- BitmapEffect.cs
- PeerPresenceInfo.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- AnnotationService.cs
- SqlCommandSet.cs
- StringKeyFrameCollection.cs
- CodeDirectiveCollection.cs
- TextEditorContextMenu.cs
- ObjectStateEntryDbDataRecord.cs
- ProfileServiceManager.cs
- UnsafeNativeMethods.cs
- Renderer.cs
- QualificationDataItem.cs
- JsonReader.cs
- Vector3DAnimationBase.cs
- ActivityExecutorDelegateInfo.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ToolboxItemAttribute.cs
- Options.cs
- MessageSmuggler.cs
- ServicesUtilities.cs
- ConnectionStringSettings.cs
- CustomCategoryAttribute.cs
- peersecurityelement.cs
- TreeView.cs
- HtmlInputImage.cs
- TdsParserSafeHandles.cs
- Calendar.cs
- SystemParameters.cs
- GeneralTransform.cs
- HashHelpers.cs
- WebBrowserUriTypeConverter.cs
- AllMembershipCondition.cs
- WebPartZoneBase.cs
- MenuCommandService.cs
- StateItem.cs
- HtmlTableRow.cs
- DbParameterCollectionHelper.cs
- XamlClipboardData.cs
- DbConnectionPoolGroup.cs
- EventRouteFactory.cs
- DbConnectionFactory.cs
- WindowHideOrCloseTracker.cs
- DocumentSchemaValidator.cs
- mediapermission.cs
- DataService.cs