2008-12-17 34 views
1

我試圖設置htmlAttribute屬性,但我不能找出正確的語法VB中Anonymous類型的語法是什麼?

這裏是它如何工作在C#

<%=Html.Password("myPassword", 50,"",new { style = "width:100px" })%><br /> 

會是什麼

new { style = "width:100px" } 
的vb.net版

回答

6

在VB中內嵌匿名類型正確的語法是:

New With { .Style = "width:100px" } 

如果要聲明一個匿名類型使用的語法如下:

Dim myVariable = New With { .Style = "width:100px" } 
相關問題