Asp.net 如何在我的操作方法中创建空的ToPagedList项并将它们传递给我的视图

Asp.net 如何在我的操作方法中创建空的ToPagedList项并将它们传递给我的视图,asp.net,asp.net-mvc,linq,entity-framework,asp.net-mvc-4,Asp.net,Asp.net Mvc,Linq,Entity Framework,Asp.net Mvc 4,我有以下行动方法:- public ActionResult Index(string searchTerm = "", int page = 1,bool forIt360only=true) { string withOutSpace = searchTerm.Trim(); if (forIt360only) { populateViewData(repository.FindVMForIT360Only().ToList().Select(a

我有以下行动方法:-

public ActionResult Index(string searchTerm = "", int page = 1,bool forIt360only=true)
{
    string withOutSpace = searchTerm.Trim();

    if (forIt360only) 
    {
        populateViewData(repository.FindVMForIT360Only().ToList().Select(a => a.RESOURCEID).ToArray());
        var vm2 = new List<TMSVirtualMachine>(5).ToPagedList(page,5);
        return View(vm2);
    }
 }
public ActionResult索引(string searchTerm=“”,int page=1,bool forIt360only=true)
{
string withOutSpace=searchTerm.Trim();
如果(仅限FORIT360)
{
填充ViewData(repository.findvmforit360 only().ToList().Select(a=>a.RESOURCEID.ToArray());
var vm2=新列表(5)。ToPagedList(第5页);
返回视图(vm2);
}
}
对于特定的需求,我需要将空的.topaged列表项传递给我的视图。我试着用

var vm2 = new List<TMSVirtualMachine>(5).ToPagedList(page,5);
var vm2=新列表(5)。ToPagedList(第5页);
创建5个空项目,但不起作用。能给我一个建议吗? 谢谢

除了“不起作用”之外,您还需要告知更多可能的副本。