Export (0) Print
Expand All

IFormatter Interface

Provides functionality for formatting serialized objects.

Namespace:  System.Runtime.Serialization
Assembly:  mscorlib (in mscorlib.dll)

[ComVisibleAttribute(true)]
public interface IFormatter

The IFormatter type exposes the following members.

  NameDescription
Public propertyBinderGets or sets the SerializationBinder that performs type lookups during deserialization.
Public propertyContextGets or sets the StreamingContext used for serialization and deserialization.
Public propertySurrogateSelectorGets or sets the SurrogateSelector used by the current formatter.
Top

  NameDescription
Public methodDeserializeDeserializes the data on the provided stream and reconstitutes the graph of objects.
Public methodSerializeSerializes an object, or graph of objects with the given root to the provided stream.
Top

This interface must be implemented by any class identified as a formatter in the System.Runtime.Serialization architecture.

Objects controlling their own serialization can do so by implementing the ISerializable interface. In order for an object to be serialized, you must mark that object as being serializable. You can do this by applying the serializable attribute to a class. If any object in the graph is not serializable, serialization will fail.

Notes to Implementers

All formatters must implement this interface. Use Serialize to serialize an object or graph of objects. Use Deserialize to deserialize a stream and create a clone of the original object or graph of objects.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft