2

我一直用New With {}没问题。为什么这不一样?

Razor 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
4

1 回答 1

1

匿名类型( New With {}) 不会扩展/继承- 并且需要AjaxOptions符合AjaxOptions的对象。BeginForm

于 2013-03-27T03:11:36.023 回答