本文整理汇总了C#中Common.List.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# List.Skip方法的具体用法?C# List.Skip怎么用?C# List.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common.List
的用法示例。
在下文中一共展示了List.Skip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: load_device
private IList<Device> load_device(string pname, string mtcode, string pindex, int tpcode, bool isallowpage, string orderby)
{
int mCode = 0;
int.TryParse(mtcode, out mCode);
IList<Device> devices = new List<Device>();
IList<Plant> plants = plantService.Getplantlikepname(pname);
foreach (Plant plant in plants)
{
foreach (Device d in plant.deviceList())
{
if (d.deviceTypeCode.Equals(tpcode) && (d.deviceModelCode.Equals(mCode) || mCode.Equals(-1)))
{
//从18版本调整设备和电站的逻辑关系为已经plantunitid后,无需这样处理了
//d.plant = plant;
devices.Add(d);
}
}
}
int.TryParse(pindex, out mCode);
Pager page = new Pager();
page.PageSize = ComConst.PageSize;
page.PageIndex = mCode;
page.RecordCount = devices.Count;
ViewData["page"] = page;
if (isallowpage)
devices = devices.Skip((mCode - 1) * page.PageSize).Take(page.PageSize).ToList<Device>();
switch (orderby)
{
case "pltname":
devices = devices.OrderBy(m => m.plant.name).ToList<Device>();
break;
case "dtype":
devices = devices.OrderBy(m => m.xinhaoName).ToList<Device>();
break;
default:
break;
}
return devices;
}
示例2: GetPersonListByGroupDepartment
/// <summary>
///
/// </summary>
/// <param name="dids"></param>
/// <param name="gids"></param>
/// <param name="pageSize"></param>
/// <param name="pageIndex"></param>
/// <param name="rowCount"></param>
/// <returns></returns>
protected List<P_PersonInfo> GetPersonListByGroupDepartment(string dids, string gids,out int rowCount, int pageSize=-1,int pageIndex=-1)
{
List<int> list_dids = new List<int>();
List<int> list_gids = new List<int>();
if (dids != "")
{
var list_dids_temp = (from g in dids.Split(',')
where g != ""
select g).ToList();
list_dids_temp.ForEach(g => list_dids.Add(int.Parse(g)));
}
if (gids != "")
{
var list_gids_temp = (from g in gids.Split(',')
where g != ""
select g).ToList();
list_gids_temp.ForEach(g => list_gids.Add(int.Parse(g)));
}
//2 根据department以及group的id查询其对应的Person对象集合
List<P_PersonInfo> list_person = new List<P_PersonInfo>();
var list_department = departmentBLL.GetListByIds(list_dids);
list_department.ForEach(d => list_person.AddRange(d.P_PersonInfo));
var list_group = groupBLL.GetListByIds(list_gids);
list_group.ForEach(g => list_person.AddRange(g.P_PersonInfo));
//3 将联系人集合去重
list_person = list_person.Distinct(new P_PersonEqualCompare()).ToList().Select(p => p.ToMiddleModel()).ToList();
list_person = list_person.OrderByDescending(a => a.isVIP).ToList();
rowCount = list_person.Count();
if (pageIndex != -1 && pageSize != -1)
{
//分页
list_person = list_person.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
}
return list_person;
}