Export (0) Print
Expand All

ObjectStateFormatter.Serialize Method (Object)

Serializes an object state graph to a base64-encoded string.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public string Serialize(
	Object stateGraph
)

Parameters

stateGraph
Type: System.Object
The object to serialize.

Return Value

Type: System.String
A base-64 encoded string that represents the serialized object state of the stateGraph parameter.

Any object graph that is serialized with the Serialize method can be deserialized with the Deserialize method. The Serialize(Object) method is used to serialize an object state graph to a base64-encoded string form.

The following code example demonstrates how to serialize the values of a set of control properties to a base64-encoded string using the Serialize(Object) method. The string can be deserialized at a later time with the Deserialize(String) method.



ArrayList controlProperties = new ArrayList(3);

controlProperties.Add( SortDirection );
controlProperties.Add( SelectedColumn );
controlProperties.Add( CurrentPage.ToString() );

// Create an ObjectStateFormatter to serialize the ArrayList.
ObjectStateFormatter formatter = new ObjectStateFormatter();

// Call the Serialize method to serialize the ArrayList to a Base64 encoded string.
string base64StateString = formatter.Serialize(controlProperties);


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Community Additions

ADD
Show:
© 2014 Microsoft