System.Web.UI.ObjectStateFormatter Class

Serializes and deserializes object graphs that represent the state of an object. This class cannot be inherited.

See Also: ObjectStateFormatter Members

Syntax

public sealed class ObjectStateFormatter : System.Runtime.Serialization.IFormatter, IStateFormatter

Remarks

The System.Web.UI.ObjectStateFormatter class serializes and deserializes object state graphs in a compact format.

System.Web.UI.ObjectStateFormatter is used by the System.Web.UI.PageStatePersister class and classes that derive from it to serialize view state and control state. It is also used by the System.Web.UI.LosFormatter class to provide object state graph formatting for various parts of the ASP.NET infrastructure.

The System.Web.UI.ObjectStateFormatter class is optimized to serialize and format many common .NET Framework reference types, as well as constants. The following table lists the types that are optimized.

Array

DateTime

short

string

ArrayList

double

int

String []

bool

Enum

null (Nothing)

string.Empty

byte

Hashtable

System.Web.UI.Pair

System.Web.UI.Triplet

char

System.Collections.Specialized.HybridDictionary

float

Type

System.Drawing.Color

IDictionary

Additionally, while conventional string types and string arrays are written to and from a serialized binary writer unaltered, some strings are optimized by creating internal string tables. Strings are optimized using these tables if the string has an associated System.ComponentModel.TypeConverter object or if the string is actually an instance of the System.Web.UI.IndexedString class.

Other types not listed above are binary-serialized using a System.Runtime.Serialization.Formatters.Binary.BinaryFormatter object if they implement the System.Runtime.Serialization.ISerializable interface or are decorated with the SerializableAttribute attribute. The System.Web.UI.ObjectStateFormatter class is not optimized for any of these serializable types.

If the System.Web.UI.ObjectStateFormatter class encounters a type that is not serializable, an ArgumentException exception is thrown.

Requirements

Namespace: System.Web.UI
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0