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.

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.

Public classFormatterProvides base functionality for the common language runtime serialization formatters.
Public classFormatterConverterRepresents a base implementation of the IFormatterConverter interface that uses the Convert class and the IConvertible interface.
Public classFormatterServicesProvides static methods to aid with the implementation of a Formatter for serialization. This class cannot be inherited.
Public classObjectIDGeneratorGenerates IDs for objects.
Public classObjectManagerKeeps track of objects as they are deserialized.
Public classOnDeserializedAttributeWhen applied to a method, specifies that the method is called immediately after deserialization of the object.
Public classOnDeserializingAttributeWhen applied to a method, specifies that the method is called during deserialization of an object.
Public classOnSerializedAttributeWhen applied to a method, specifies that the method is called after serialization of an object graph.
Public classOnSerializingAttributeWhen applied to a method, specifies that the method is called before serialization of an object.
Public classOptionalFieldAttributeSpecifies that a field can be missing from a serialization stream so that the BinaryFormatter and the SoapFormatter does not throw an exception.
Public classSerializationBinderAllows users to control class loading and mandate what class to load.
Public classSerializationExceptionThe exception thrown when an error occurs during serialization or deserialization.
Public classSerializationInfoStores all the data needed to serialize or deserialize an object. This class cannot be inherited.
Public classSerializationInfoEnumeratorProvides a formatter-friendly mechanism for parsing the data in SerializationInfo. This class cannot be inherited.
Public classSerializationObjectManagerManages serialization processes at run time. This class cannot be inherited.
Public classSurrogateSelectorAssists formatters in selection of the serialization surrogate to delegate the serialization or deserialization process to.

Public interfaceIDeserializationCallbackIndicates that a class is to be notified when deserialization of the entire object graph has been completed.
Public interfaceIFormatterProvides functionality for formatting serialized objects.
Public interfaceIFormatterConverterProvides the connection between an instance of SerializationInfo and the formatter-provided class best suited to parse the data inside the SerializationInfo.
Public interfaceIObjectReferenceIndicates that the current interface implementer is a reference to another object.
Public interfaceISerializableAllows an object to control its own serialization and deserialization.
Public interfaceISerializationSurrogateImplements a serialization surrogate selector that allows one object to perform serialization and deserialization of another.
Public interfaceISurrogateSelectorIndicates a serialization surrogate selector class.

Public structureSerializationEntryHolds the value, Type, and name of a serialized object.
Public structureStreamingContextDescribes the source and destination of a given serialized stream, and provides an additional caller-defined context.

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