This documentation is archived and is not being maintained.

IFormatter.Serialize Method

Serializes an object, or graph of objects with the given root to the provided stream.

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

void Serialize(
	Stream serializationStream,
	Object graph
)

Parameters

serializationStream
Type: System.IO.Stream

The stream where the formatter puts the serialized data. This stream can reference a variety of backing stores (such as files, network, memory, and so on).

graph
Type: System.Object

The object, or root of the object graph, to serialize. All child objects of this root object are automatically serialized.

The Serialize method automatically serializes the provided objects, and all objects connected to it, to the provided stream.

By default, the serialization process records an object's state by gathering the values of all its fields (public and private). These fields are saved to the stream along with information about the object such as the name qualified by the assembly for its type.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Show: