C#数据分组

 1 static List<List<T>> DataPartial<T>(List<T> targetList, int count)
 2         {
 3             List<List<T>> target = new List<List<T>>();
 4             for (int i = 0; i < targetList.Count; i = i + count)
 5             {
 6                 List<T> temp = new List<T>();
 7                 for (int w = i; w < i + count; w++)
 8                 {
 9                     if (w == targetList.Count)
10                         break;
11                     else
12                         temp.Add(targetList[w]);
13                 }
14                 target.Add(temp);
15             }
16             return target;
17         }
原文地址:https://www.cnblogs.com/kaisame/p/9394377.html