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
- CallId.cs
- ActivationServices.cs
- NavigationCommands.cs
- TextDecorationCollectionConverter.cs
- ProcessHostServerConfig.cs
- AssociationEndMember.cs
- AttributeProviderAttribute.cs
- NetDataContractSerializer.cs
- XmlSchemaValidator.cs
- DesignerActionPanel.cs
- EFAssociationProvider.cs
- PersistChildrenAttribute.cs
- RowBinding.cs
- MbpInfo.cs
- ObjectSet.cs
- QilUnary.cs
- SQLUtility.cs
- TextPatternIdentifiers.cs
- Glyph.cs
- SqlDependency.cs
- CrossAppDomainChannel.cs
- Scripts.cs
- Rules.cs
- ButtonStandardAdapter.cs
- CodeArgumentReferenceExpression.cs
- WorkflowTransactionOptions.cs
- XmlCodeExporter.cs
- ZipIOExtraField.cs
- References.cs
- VirtualPath.cs
- SortQuery.cs
- OdbcErrorCollection.cs
- XmlDeclaration.cs
- TraceLevelStore.cs
- BaseTemplateBuildProvider.cs
- ProfessionalColorTable.cs
- CodeMemberMethod.cs
- TextRunProperties.cs
- BitmapMetadataEnumerator.cs
- EventLogPermissionEntry.cs
- EntityPropertyMappingAttribute.cs
- WebPartDisplayModeCancelEventArgs.cs
- AnyAllSearchOperator.cs
- ChannelManager.cs
- EditorAttribute.cs
- DBNull.cs
- WebSysDescriptionAttribute.cs
- ClientData.cs
- WebPartHeaderCloseVerb.cs
- RijndaelManaged.cs
- PointF.cs
- RotateTransform.cs
- XmlTextWriter.cs
- SamlDoNotCacheCondition.cs
- Viewport2DVisual3D.cs
- DescendantOverDescendantQuery.cs
- WebPartEditorApplyVerb.cs
- XmlSchemaSimpleContentRestriction.cs
- PointCollection.cs
- SuppressMergeCheckAttribute.cs
- WebPartsPersonalizationAuthorization.cs
- ToolStripPanelSelectionGlyph.cs
- SqlConnectionHelper.cs
- TransactionFormatter.cs
- PackUriHelper.cs
- AttachedAnnotationChangedEventArgs.cs
- RadioButtonStandardAdapter.cs
- Setter.cs
- SecurityUtils.cs
- CodeConditionStatement.cs
- AppearanceEditorPart.cs
- ProfessionalColors.cs
- PreservationFileWriter.cs
- ErrorStyle.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- _NestedSingleAsyncResult.cs
- BufferedStream.cs
- DataTransferEventArgs.cs
- QilReplaceVisitor.cs
- LinqDataSourceEditData.cs
- HttpListener.cs
- Comparer.cs
- HyperLinkStyle.cs
- TreeWalkHelper.cs
- DataObjectAttribute.cs
- EnumCodeDomSerializer.cs
- DataGridViewRowPostPaintEventArgs.cs
- StorageEntitySetMapping.cs
- QilNode.cs
- SimpleApplicationHost.cs
- ToolStripControlHost.cs
- AuthenticationModuleElementCollection.cs
- X509CertificateChain.cs
- DynamicValueConverter.cs
- ObjectConverter.cs
- NavigationEventArgs.cs
- HostedImpersonationContext.cs
- WorkflowMarkupSerializerMapping.cs
- BamlBinaryReader.cs
- DPTypeDescriptorContext.cs