1

当我只传递 2 个参数时它是如何工作的

列表.cshtml

@Html.PageLinks(Model.PagingInfo, x => Url.Action("List", new { page = x }))

进入这个方法?PagingHelpers.cs

public static MvcHtmlString PageLinks(this HtmlHelper html,
            PagingInfo pagingInfo,
            Func<int, string> pageUrl)
4

1 回答 1

3

这里的关键在于方法签名的这一部分:this HtmlHelper html. this表示该方法是 的实例的扩展方法HtmlHelper

所以HtmlHelper html提供给方法的是本地Html属性。

于 2019-06-15T18:13:00.070 回答