Skip to main content
 首页 » 编程设计

c#之如何在 C# 中将一个集合划分为每个 50 个元素的子集合

2024年01月22日30itcoder

<分区>

我有一个看起来像这样的集合:

IList<TQBase> = hq; 
 
public class TQBase 
{ 
    public int i { get; set; } 
    public int q { get; set; } 
} 

该集合中有 300 多件元素。

现在我需要创建这些集合的集合,这样:

h[0] = the first fifty elements of hq 
h[1] = the next fifty elements of hq 
... 
h[n] = any remaining elements of hq 

谁能建议我创建第二个系列的方法。这是什么东西吗 我可以用 Linq 做还是有更简单的方法?