You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
930 B
39 lines
930 B
3 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
|
||
|
namespace EC.Utils
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// ExtList
|
||
|
/// 版 本:V3.0.0
|
||
|
/// 版 权:EasyCode
|
||
|
/// 作 者:LXC
|
||
|
/// </summary>
|
||
|
public static class ExtList
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// List分页
|
||
|
/// </summary>
|
||
|
/// <param name="data">表数据</param>
|
||
|
/// <param name="pagination">分页参数</param>
|
||
|
/// <returns></returns>
|
||
|
public static List<T> GetPage<T>(List<T> data, PageInput pagination)
|
||
|
{
|
||
|
return data.Skip(pagination.currentPage * pagination.pageSize - pagination.pageSize).Take(pagination.pageSize).ToList();
|
||
|
}
|
||
|
|
||
|
/// <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);
|
||
|
}
|
||
|
}
|
||
|
}
|