JavaScriptConverter::Deserialize Method
When overridden in a derived class, converts the provided dictionary into an object of the specified type.
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
public: virtual Object^ Deserialize( IDictionary<String^, Object^>^ dictionary, Type^ type, JavaScriptSerializer^ serializer ) abstract
Parameters
- dictionary
- Type: System.Collections.Generic::IDictionary<String, Object>
An IDictionary<TKey, TValue> instance of property data stored as name/value pairs.
- type
- Type: System::Type
The type of the resulting object.
- serializer
- Type: System.Web.Script.Serialization::JavaScriptSerializer
The JavaScriptSerializer instance.
The Deserialize 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 method instead. The converter should call this method of the JavaScriptSerializer instance available from the serializer parameter.
The ConvertToType method enables converter to pass a property value from dictionary, and then return a value of the expected type. In some cases, a converter for a custom type might be working 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). In that case, invoking ConvertToType makes sure that custom converters will be recursively invoked for property data that is contained in the dictionary. When the converter has iterated through all entries in the dictionary, it returns a constructed instance of the target type.
If the converter encounters a problem during deserialization, it should throw an InvalidOperationException error that describes the problem.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, 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.