Dela via


HtmlHelper.ObjectToDictionary(Object) Method

Definition

Creates a dictionary from an object, by adding each public instance property as a key with its associated value to the dictionary. It will expose public properties from derived types as well. This is typically used with objects of an anonymous type.

If the value is already an IDictionary<TKey,TValue> instance, then it is returned as-is. new { data_name="value" } will translate to the entry { "data_name", "value" } in the resulting dictionary.

public:
 static System::Collections::Generic::IDictionary<System::String ^, System::Object ^> ^ ObjectToDictionary(System::Object ^ value);
public static System.Collections.Generic.IDictionary<string,object> ObjectToDictionary (object value);
static member ObjectToDictionary : obj -> System.Collections.Generic.IDictionary<string, obj>
Public Shared Function ObjectToDictionary (value As Object) As IDictionary(Of String, Object)

Parameters

value
Object

The Object to be converted.

Returns

The created dictionary of property names and property values.

Applies to