System.Runtime.Serialization Namespace

The System.Runtime.Serialization namespace contains classes that can be used for serializing and deserializing objects. Serialization is the process of converting an object or a graph of objects into a linear sequence of bytes for either storage or transmission to another location. Deserialization is the process of taking in stored information and recreating objects from it.

Remarks

The ISerializable interface provides a way for classes to control their own serialization behavior. Classes in the System.Runtime.Serialization.Formatters namespace control the actual formatting of various data types encapsulated in the serialized objects.

Formatters that serialize and deserialize objects to and from a particular format can be found in the System.Runtime.Serialization.Formatters namespace.

Classes

TypeReason
CollectionDataContractAttribute

When applied to a collection type, enables custom specification of the collection item elements. This attribute can be applied only to types that are recognized by the DataContractSerializer as valid, serializable collections.

ContractNamespaceAttribute

Specifies the CLR namespace and XML namespace of the data contract.

DataContractAttribute

Specifies that the type defines or implements a data contract and is serializable by a serializer, such as the DataContractSerializer. To make their type serializable, type authors must define a data contract for their type.

DataContractResolver

Provides a mechanism for dynamically mapping types to and from xsi:type representations during serialization and deserialization.

DataContractSerializer

Serializes and deserializes an instance of a type into an XML stream or document using a supplied data contract. This class cannot be inherited.

DataContractSerializerSettings

Specifies data contract serializer settings.

DataMemberAttribute

When applied to the member of a type, specifies that the member is part of a data contract and is serializable by the DataContractSerializer.

DateTimeFormat

Specifies date-time format options.

EmitTypeInformation

Specifies how often to emit type information.

EnumMemberAttribute

Specifies that the field is an enumeration member and should be serialized.

ExportOptions

Represents the options that can be set for an XsdDataContractExporter.

ExtensionDataObject

Stores data from a versioned data contract that has been extended by adding new members.

Formatter

Provides base functionality for the common language runtime serialization formatters.

FormatterConverter

Represents a base implementation of the IFormatterConverter interface that uses the Convert class and the IConvertible interface.

FormatterServices

Provides static methods to aid with the implementation of a Formatter for serialization. This class cannot be inherited.

IDataContractSurrogate

Provides the methods needed to substitute one type for another by the DataContractSerializer during serialization, deserialization, and export and import of XML schema documents (XSD).

IDeserializationCallback

Indicates that a class is to be notified when deserialization of the entire object graph has been completed. Note that this interface is not called when deserializing with the XmlSerializer (System.Xml.Serialization.XmlSerializer).

IExtensibleDataObject

Provides a data structure to store extra data encountered by the XmlObjectSerializer during deserialization of a type marked with the DataContractAttribute attribute.

IFormatter

Provides functionality for formatting serialized objects.

IFormatterConverter

Provides the connection between an instance of SerializationInfo and the formatter-provided class best suited to parse the data inside the SerializationInfo.

IgnoreDataMemberAttribute

When applied to the member of a type, specifies that the member is not part of a data contract and is not serialized.

ImportOptions

Represents the options that can be set on an XsdDataContractImporter.

InvalidDataContractException

The exception that is thrown when the DataContractSerializer or NetDataContractSerializer encounters an invalid data contract during serialization and deserialization.

IObjectReference

Indicates that the current interface implementer is a reference to another object.

ISafeSerializationData

Enables serialization of custom exception data in security-transparent code.

ISerializable

Allows an object to control its own serialization and deserialization.

ISerializationSurrogate

Implements a serialization surrogate selector that allows one object to perform serialization and deserialization of another.

ISurrogateSelector

Indicates a serialization surrogate selector class.

KnownTypeAttribute

Specifies types that should be recognized by the DataContractSerializer when serializing or deserializing a given type.

NetDataContractSerializer

Serializes and deserializes an instance of a type into XML stream or document using the supplied dnprdnshort types. This class cannot be inherited.

ObjectIDGenerator

Generates IDs for objects.

ObjectManager

Keeps track of objects as they are deserialized.

OnDeserializedAttribute

When applied to a method, specifies that the method is called immediately after deserialization of an object in an object graph. The order of deserialization relative to other objects in the graph is non-deterministic.

OnDeserializingAttribute

When applied to a method, specifies that the method is called during deserialization of an object in an object graph. The order of deserialization relative to other objects in the graph is non-deterministic.

OnSerializedAttribute

When applied to a method, specifies that the method is called after serialization of an object in an object graph. The order of serialization relative to other objects in the graph is non-deterministic.

OnSerializingAttribute

When applied to a method, specifies that the method is during serialization of an object in an object graph. The order of serialization relative to other objects in the graph is non-deterministic.

OptionalFieldAttribute

Specifies that a field can be missing from a serialization stream so that the BinaryFormatter and the SoapFormatter does not throw an exception.

SafeSerializationEventArgs

Provides data for the SerializeObjectState event.

SerializationBinder

Allows users to control class loading and mandate what class to load.

SerializationEntry

Holds the value, Type, and name of a serialized object.

SerializationException

The exception thrown when an error occurs during serialization or deserialization.

SerializationInfo

Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.

SerializationInfoEnumerator

Provides a formatter-friendly mechanism for parsing the data in SerializationInfo. This class cannot be inherited.

SerializationObjectManager

Manages serialization processes at run time. This class cannot be inherited.

StreamingContext

Describes the source and destination of a given serialized stream, and provides an additional caller-defined context.

StreamingContextStates

Defines a set of flags that specifies the source or destination context for the stream during serialization.

SurrogateSelector

Assists formatters in selection of the serialization surrogate to delegate the serialization or deserialization process to.

XmlObjectSerializer

Provides the base class used to serialize objects as XML streams or documents. This class is abstract.

XmlSerializableServices

Contains methods for reading and writing XML.

XsdDataContractExporter

Allows the transformation of a set of dnprdnshort types that are used in data contracts into an XML schema file (.xsd).

XsdDataContractImporter

Allows the transformation of a set of XML schema files (.xsd) into common language runtime (CLR) types.