Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.








Deserialize Method (dictionary, type, serializer)

When overridden in a derived class, converts the provided dictionary into an object of the specified type.



public abstract Object Deserialize (
	IDictionary<string, Object> dictionary,
	Type type,
	JavaScriptSerializer serializer


Public MustOverride Function Deserialize ( _
	dictionary As IDictionary(Of String, Object), _
	type As Type, _
	serializer As JavaScriptSerializer _
) As Object


virtual Object^ Deserialize (
	IDictionary<String^, Object^>^ dictionary, 
	Type^ type, 
	JavaScriptSerializer^ serializer
) abstract


public abstract Object Deserialize (
	IDictionary<String, Object> dictionary,
	Type type,
	JavaScriptSerializer serializer


dictionary (IDictionary<(Of String, Object>))

An IDictionary instance of property data stored as name/value pairs.

type (Type)

The Type of the resulting object.

serializer (JavaScriptSerializer)

The JavaScriptSerializer instance.

Return Value

Return Value

The deserialized Object.

Notes For Inheritors

The Deserialize(IDictionary<(Of String, Object>), Type, JavaScriptSerializer) method iterates through the values in the dictionary parameter to construct an instance of the type requested in the type parameter. Although a converter can directly use values from dictionary, we recommend that the converter implementer use the ConvertToType<(Of T>)(Object) method instead. The converter should call this method on the JavaScriptSerializer instance available from the serializer parameter.

The ConvertToType<(Of T>)(Object) method allows the converter to pass in a property value from dictionary, and then return a value of the expected type. If a converter for a custom type is dealing with properties that themselves have registered converters (for example, type A has a property of type B, and type B is also associated with a custom converter), invoking ConvertToType<(Of T>)(Object) ensures that custom converters will be recursively invoked for property data that is contained in the dictionary. When the converter has successfully iterated through all entries in the dictionary, it returns a constructed instance of the target type.

If for some reason the converter encounters a problem during deserialization, it should throw an InvalidOperationException that describes the problem.

Assembly: System.Web.Extensions (Module: System.Web.Extensions)