当前位置:网站首页>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
边栏推荐
- ROS学习笔记-----ROS的使用教程
- Normalized transforms in pytorch The real calculation process of normalize
- How to learn software testing? Self study or training? After reading this article, you will understand
- The more you use the computer, the slower it will be? Recovery method of file accidental deletion
- Lunch on the 23rd day at home
- Pipes and xargs
- unity 功能扩展
- C knowledge
- Addition, deletion, modification and query of MySQL advanced table
- Pycharm download and installation
猜你喜欢
[leetcode refers to the two numbers of offer 57. And S (simple)]
The more you use the computer, the slower it will be? Recovery method of file accidental deletion
Keywords static, extern + global and local variables
在线Excel转CSV工具
Amazon and epic will be settled, and the Microsoft application mall will be opened to third parties
Problem brushing plan -- dynamic programming (III)
Deep understanding of modern mobile GPU (continuously updating)
2. Finishing huazi Mianjing -- 2
ROS learning notes - tutorial on the use of ROS
CUDA, NVIDIA driver, cudnn download address and version correspondence
随机推荐
Deep understanding of modern mobile GPU (continuously updating)
Explore ASP Net core read request The correct way of body
How to learn software testing? Self study or training? After reading this article, you will understand
[leetcode refers to offer 27. Image of binary tree (simple)]
如何发挥测试策略的指导性作用
Question brushing plan - depth first search DFS (I)
Detailed explanation of basic assembly instructions of x86 architecture
Use 3080ti to run tensorflow GPU = 1 X version of the source code
在线时序流程图制作工具
thinkphp5+数据大屏展示效果
Sklearn function: Train_ Test_ Split (split training set and test set)
Send email to laravel
Introduction to tensorrt
Opencv reports an error. Expected PTR < CV:: UMAT > for argument '% s'‘
[※ leetcode refers to offer 48. The longest substring without repeated characters (medium)]
韩国或将禁止苹果和谷歌向开发者抽佣 创全球首例
presto on spark 支持3.1.3记录
Xiaomi mobile phone has abandoned the "Mi" brand all over the world and switched to the full name brand of "Xiaomi"
Thinking after learning to type
Amazon and epic will be settled, and the Microsoft application mall will be opened to third parties