当前位置:网站首页>C list data paging
C list data paging
2022-04-23 21:25:00 【Plant a sweet smell】
c# List Data paging
#### List Paging
#region List Paging
/// <summary>
/// List Paging
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="_list"></param>
/// <param name="PageIndex"></param>
/// <param name="PageSize"></param>
/// <returns></returns>
public static List<T> SplitList<T>(List<T> _list, int PageIndex, int PageSize)
{
int _PageIndex = PageIndex == 0 ? 1 : PageIndex;
int _PageSize = PageSize == 0 ? 20 : PageSize;
int PageConut = (int)Math.Ceiling(Convert.ToDecimal(_list.Count) / _PageSize);
if (PageConut >= _PageIndex)
{
List<T> list = new List<T>();
list = _list.Skip((_PageIndex - 1) * _PageSize).Take(_PageSize).ToList();
return list;
}
else
return _list;
}
#endregion
List Cyclic paging processing
#region List Cyclic paging processing
/// <summary>
/// List Paging
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="_list"></param>
/// <param name="PageIndex"></param>
/// <param name="PageSize"></param>
/// <returns></returns>
public static void SplitList<T>(List<T> _list, int PageIndex, int PageSize)
{
int _PageIndex = PageIndex == 0 ? 1 : PageIndex;
int _PageSize = PageSize == 0 ? 20 : PageSize;
int PageConut = (int)Math.Ceiling(Convert.ToDecimal(_list.Count) / _PageSize);
if (PageConut >= _PageIndex)
{
for(int i=0,i<PageConut,i++)
List<T> list = new List<T>();
list = _list.Skip(PageConut * _PageSize).Take(_PageSize).ToList();
//your code list
}
else
{
//your code _list
}
}
#endregion
May people sleep , One after another dreamed of stars that would never fall to the ground ; May people get drunk , One after another, they think of the poems they read when they were young !!!
版权声明
本文为[Plant a sweet smell]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/110/202204200619557083.html
边栏推荐
- Express③(使用Express编写接口、跨域有关问题)
- DW basic tutorial (I)
- Pycharm Chinese plug-in
- [leetcode sword finger offer 10 - II. Frog jumping steps (simple)]
- Sklearn function: Train_ Test_ Split (split training set and test set)
- unity 功能扩展
- setInterval、setTimeout、requestAnimationFrame
- The computer is out of power. How did I pass the terrible interview of Tencent cloud?
- DW basic course (II)
- Deno 1.13.2 发布
猜你喜欢
![[leetcode sword finger offer 58 - I. flip word order (simple)]](/img/25/e000531faeaee2eac18d9a634e203b.png)
[leetcode sword finger offer 58 - I. flip word order (simple)]
![[leetcode refers to offer 18. Delete the node of the linked list (simple)]](/img/ee/1a546e2383948ad9a4ce69b4508e90.png)
[leetcode refers to offer 18. Delete the node of the linked list (simple)]

3-5 obtaining cookies through XSS and the use of XSS background management system

IIS cannot load * woff,*. woff2,*. Solution of SVG file

Some grounded words

Win 11K in 100 days, super complete learning guide for job transfer test

Yolov5 NMS source code understanding

在线Excel转CSV工具

Google tries to use rust in Chrome

2.整理华子面经--2
随机推荐
Question brushing plan - depth first search (II)
Tensorflow1. X and 2 How does x read those parameters saved in CKPT
presto on spark 支持3.1.3记录
[leetcode refers to the two numbers of offer 57. And S (simple)]
[leetcode refers to offer 25. Merge two sorted linked lists (simple)]
[leetcode refers to offer 21. Adjust the array order so that odd numbers precede even numbers (simple)]
Lunch on the 23rd day at home
Assertionerror: invalid device ID and runtimeerror: CUDA error: invalid device ordinal
Sequential state
C, print the source program of beautiful bell triangle
Send email to laravel
Reference of custom message in ROS function pack failed
C knowledge
Some thoughts on super in pytorch, combined with code
Two Stage Detection
JS prototype and prototype chain
Pytorch: runtimeerror: an attempt has been made to start a new process Error reporting (resolved)
MySQL advanced common functions
DW basic course (II)
Problem brushing plan -- dynamic programming (IV)