You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
比如分页中的PageQueryResult,应该有更好的选择,如果只是为了传出数据总条数,可以使用List中的Capacity,或者继承List实现一个新类,但返回List,使用拓展方法获得总条数
比如:
class PageingList : List
{
public int TotalCount {get;set;}
}
static class ExtMethod
{
public int GetTotalCount(this List list)
{
if(list is PageingList)
{
return ((PageingList)list).TotalCount;
}else
{
return list.Count;
}
}
}
//分页方法中
public List Pageing(int size,int pageindex)
{
.....
return new PageingList (){ Total = 10000 };
}
The text was updated successfully, but these errors were encountered:
比如分页中的PageQueryResult,应该有更好的选择,如果只是为了传出数据总条数,可以使用List中的Capacity,或者继承List实现一个新类,但返回List,使用拓展方法获得总条数
比如:
class PageingList : List
{
public int TotalCount {get;set;}
}
static class ExtMethod
{
public int GetTotalCount(this List list)
{
if(list is PageingList)
{
return ((PageingList)list).TotalCount;
}else
{
return list.Count;
}
}
}
//分页方法中
public List Pageing(int size,int pageindex)
{
.....
return new PageingList (){ Total = 10000 };
}
The text was updated successfully, but these errors were encountered: