【问题标题】:Using @Model in VB ASP.Net MVC 5在 VB ASP.Net MVC 5 中使用 @Model
【发布时间】:2026-02-03 14:35:01
【问题描述】:

我正在阅读http://www.asp.net 上的教程“使用 MVC 5 开始使用 EF6”,并在进行过程中转换为 VB。

在第三个教程“排序、过滤和分页”(http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application) 中有一个“将分页链接添加到学生索引视图”部分,其中 C# 代码是

@model PagedList.IPagedList<Student>
...

我将此语句转换为 @Model PagedList.IPagedlist(Of Student)

这可以编译,但我没有得到语法着色,并且网页上的输出显示 PagedList.PagedList`1[ContosoUniversity.Student] PagedList.IPagedlist(Of Student)

我应该如何将其转换为正常工作。

【问题讨论】:

    标签: asp.net-mvc vb.net razor


    【解决方案1】:

    对于.vbhtml 文件,请使用@ModelType,而不是@Model

    【讨论】: