Serializes and deserializes object graphs that represent the state of an object. This class cannot be inherited.
See Also: ObjectStateFormatter Members
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 | |||
ArrayList |
String [] | ||
bool |
null (Nothing) | ||
byte | |||
char | |||
System.Drawing.Color |
|
|
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.