我的视图页面是这样的;
@model IEnumerable<Project.ViewModels.ViewModel>
@using Helpers
@foreach (var item in Model)
{
@Html.MyCustomHtmlHelper("test")
}
我的自定义 HtmlHelper 像这样;
public static MvcHtmlString MyCustomHtmlHelper(this HtmlHelper helper, string TestValue)
{
var builder = new StringBuilder();
builder.Append(TestValue);
return MvcHtmlString.Create(builder.ToString());
}
它适用于@model Project.ViewModels.ViewModel
但不适用@model IEnumerable<Project.ViewModels.ViewModel>
我的错误;