using System;
using System.Collections;
using System.Collections.Generic;
namespace Nirvana.Common.Extend
{
public static class ExtList
{
///
/// 获取表里某页的数据
///
/// 表数据
/// 当前页
/// 分页大小
/// 返回总页数
/// 返回当页表数据
public static List GetPage(this List data, int pageIndex, int pageSize, out int allPage)
{
allPage = 1;
return null;
}
///
/// IList转成List
///
///
///
///
public static List IListToList(IList list)
{
T[] array = new T[list.Count];
list.CopyTo(array, 0);
return new List(array);
}
///
/// list去重
///
///
///
///
public static List IDistinctList(this List list)
{
if(list == null || list.Count == 0)
{
return new List();
}
List newlist = new List();
foreach(var item in list)
{
if(!newlist.Exists(x=>x == item))
{
newlist.Add(item);
}
}
return newlist;
}
public static List IDistinctList(this List list)
{
if (list == null || list.Count == 0)
{
return new List();
}
List newlist = new List();
foreach (var item in list)
{
if (!newlist.Exists(x => x== item))
{
newlist.Add(item);
}
}
return newlist;
}
}
}