共用方式為


HtmlHelper.AnonymousObjectToHtmlAttributes(Object) 方法

定義

從輸入物件建立 HTML 屬性的字典,將底線轉譯為每個公用實例屬性中的虛線。

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)

參數

htmlAttributes
Object

描述 HTML 屬性的匿名物件。

傳回

表示 HTML 屬性的字典。

備註

如果物件已經是 IDictionary<TKey,TValue> 實例,則會傳回淺層複本。

new { data_name="value" } 將會轉譯成所產生字典中的專案 { "data-name", "value" }

適用於