This documentation is archived and is not being maintained.

ObjectStateFormatter.Deserialize Method (String)

Deserializes an object state graph from its serialized base64-encoded string form.

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

public Object Deserialize(
	string inputString
)

Parameters

inputString
Type: System.String
A string that the ObjectStateFormatter deserializes into an initialized object.

Return Value

Type: System.Object
An object that represents a deserialized object state graph.

ExceptionCondition
ArgumentNullException

The specified inputString is null or has a Length of 0.

ArgumentException

The serialized data is invalid.

HttpException

The machine authentication code (MAC) validation check that is performed when deserializing view state fails.

Any object state graph that is serialized with the Serialize method can be deserialized with the Deserialize method. The Deserialize(String) method is used to restore an object state graph stored in base64-encoded string form.

The following code example demonstrates how to implement a method that deserializes a base64-encoded string and returns an ICollection collection of property settings. This code example relies on the property settings having been serialized with the ObjectStateFormatter class, as shown in the Serialize(Object) method.


private ICollection LoadControlProperties (string serializedProperties) {

    ICollection controlProperties = null;

    // Create an ObjectStateFormatter to deserialize the properties.
    ObjectStateFormatter formatter = new ObjectStateFormatter();

    // Call the Deserialize method.
    controlProperties = (ArrayList) formatter.Deserialize(serializedProperties);

    return 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.
Show: