2013-03-27 16 views
1

我一直使用New With {}沒有問題。爲什麼這是不同的?爲什麼新建<Type>使用{}工作但New With {}不工作?

剃刀VB.NET代碼

Using Ajax.BeginForm(New AjaxOptions With {.HttpMethod = "Post"}) 
    @* no problem *@ 
End Using 
Using Ajax.BeginForm(New With {.HttpMethod = "Post"}) 
    @* Value of type '<anonymous type>' cannot be converted to 'System.Web.Mvc.Ajax.AjaxOptions'. *@ 
End Using 

回答

1

一種anonymous typeNew With {})不延伸/繼承AjaxOptions - 和符合AjaxOptions,其目的在於通過需要BeginForm

相關問題