我在 WebMatrix 中创建了自己的数据网格助手。分页和排序链接也是助手,但我真的不想将这些助手公开暴露给应用程序的其余部分。
例如:
@helper Pager(IEnumerable<dynamic> gridData,
int totalRows, int currentPage, int rowsPerPage)
{
// Helper code is here.
}
有没有办法让助手私有?无论如何,这会是一个坏习惯吗?我知道有私有函数,但从句法的角度来看,助手很方便。