HtmlHelper.AnonymousObjectToHtmlAttributes(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for