ObjectStateFormatter.Serialize Method (Object)
.NET Framework (current version)
Serializes an object state graph to a base64-encoded string.
Assembly: System.Web (in System.Web.dll)
Parameters
- stateGraph
-
Type:
System.Object
The object to serialize.
Return Value
Type: System.StringA 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.
Dim controlProperties As New ArrayList(3) controlProperties.Add(SortDirection) controlProperties.Add(SelectedColumn) controlProperties.Add(CurrentPage.ToString()) ' Create an ObjectStateFormatter to serialize the ArrayList. Dim formatter As New ObjectStateFormatter() ' Call the Serialize method to serialize the ArrayList to a Base64 encoded string. Dim base64StateString As String = formatter.Serialize(controlProperties)
.NET Framework
Available since 2.0
Available since 2.0
Show: