在 ASP.NET MVC 视图助手中,您可以执行类似的操作
<%= Html.ActionLink("click me", "DoSomething", null, new { someAttribute = "a value" } ) %>
这将产生以下 HTML
<a href="DoSomething" someAttribute="a value">click me</a>
我的问题是....如果我想设置“类”属性怎么办?
<%= Html.ActionLink("click me", "DoSomething", null, new { class = "a-class-name" } ) %>
这不会编译,因为“类”是保留字。
有解决办法吗?