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