HtmlHelper.AnonymousObjectToHtmlAttributes(Object) Method

Definition

Creates a dictionary of HTML attributes from the input object, translating underscores to dashes in each public instance property.

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

Parameters

htmlAttributes
Object

Anonymous object describing HTML attributes.

Returns

IDictionary<String,Object>

A dictionary that represents HTML attributes.

Remarks

If the object is already an IDictionary<TKey,TValue> instance, then a shallow copy is returned.

new { data_name="value" } will translate to the entry { "data-name", "value" } in the resulting dictionary.

Applies to