gpt4 book ai didi

c# - c#中的List数组

转载 作者:IT王子 更新时间:2023-10-29 03:54:27 25 4
gpt4 key购买 nike

我想要一个列表数组。在 C++ 中,我喜欢:

List<int> a[100];

这是一个包含 100 个列表的数组。每个列表可以包含许多元素。我不知道如何在 c# 中执行此操作。谁能帮帮我?

最佳答案

你这样做:

List<int>[] a = new List<int>[100];

现在你有一个类型为 List<int> 的数组包含 100 个空引用。您必须创建列表并放入数组中,例如:

a[0] = new List<int>();

关于c# - c#中的List数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7464724/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com