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
- BoundsDrawingContextWalker.cs
- RestHandlerFactory.cs
- MaterializeFromAtom.cs
- ProvidePropertyAttribute.cs
- ConfigXmlSignificantWhitespace.cs
- ArrayConverter.cs
- DataFormats.cs
- SrgsElementList.cs
- SingleResultAttribute.cs
- WorkflowMarkupSerializerMapping.cs
- DataGridViewLinkColumn.cs
- SchemaObjectWriter.cs
- MultipartContentParser.cs
- XmlUTF8TextWriter.cs
- PageEventArgs.cs
- CodeTypeParameter.cs
- InternalBase.cs
- MarkupExtensionParser.cs
- WebPartManagerInternals.cs
- BitmapDecoder.cs
- EdmToObjectNamespaceMap.cs
- SmiGettersStream.cs
- Cursor.cs
- ResXResourceSet.cs
- TaskFactory.cs
- FreezableDefaultValueFactory.cs
- CopyOnWriteList.cs
- MetaData.cs
- DATA_BLOB.cs
- ToolStripPanelCell.cs
- AssociationEndMember.cs
- MobileTextWriter.cs
- ObjectTokenCategory.cs
- ErasingStroke.cs
- SqlNamer.cs
- ContainerParaClient.cs
- TextAction.cs
- BrowserCapabilitiesCodeGenerator.cs
- Effect.cs
- DataGridViewCellStyleConverter.cs
- SqlUdtInfo.cs
- FrameworkContextData.cs
- ServiceReference.cs
- Contracts.cs
- SoapMessage.cs
- PolyLineSegment.cs
- SecurityProtocolFactory.cs
- EventProxy.cs
- EncoderParameters.cs
- OSFeature.cs
- CipherData.cs
- XmlObjectSerializerContext.cs
- HScrollProperties.cs
- UIElementParagraph.cs
- KeyManager.cs
- EventWaitHandleSecurity.cs
- WorkflowTransactionOptions.cs
- IsolatedStorageFilePermission.cs
- WebPartZoneCollection.cs
- XslTransform.cs
- SymDocumentType.cs
- DebugView.cs
- BamlBinaryWriter.cs
- DirectoryNotFoundException.cs
- EasingKeyFrames.cs
- EditingCommands.cs
- SqlCacheDependencySection.cs
- ForEachAction.cs
- RoutedCommand.cs
- KeyInstance.cs
- Activator.cs
- LowerCaseStringConverter.cs
- ServiceBehaviorElement.cs
- CompoundFileDeflateTransform.cs
- RoleService.cs
- RuntimeEnvironment.cs
- DataGrid.cs
- IInstanceTable.cs
- VisualStyleTypesAndProperties.cs
- SvcMapFileLoader.cs
- XmlSchemaValidator.cs
- ImageListStreamer.cs
- ByteStream.cs
- MatrixTransform.cs
- RC2.cs
- PreProcessInputEventArgs.cs
- XPathAxisIterator.cs
- AbsoluteQuery.cs
- EventDescriptor.cs
- COM2ComponentEditor.cs
- ThicknessAnimationBase.cs
- TextSelectionHighlightLayer.cs
- MenuScrollingVisibilityConverter.cs
- DataGridViewTextBoxColumn.cs
- ImageCodecInfoPrivate.cs
- BindStream.cs
- ProcessHost.cs
- RTLAwareMessageBox.cs
- EntityModelBuildProvider.cs
- DoubleKeyFrameCollection.cs