2013-03-27 67 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

相关问题