相关疑难解决方法(0)

为什么在构造上提供足够的尺寸时列表插入失败?

如果我们有以下变量声明:

List<int> list = new List(5);
Run Code Online (Sandbox Code Playgroud)

为什么这样:

list.insert(2, 3);
Run Code Online (Sandbox Code Playgroud)

失败,出现以下错误:

Index must be within the bounds of the List.
Run Code Online (Sandbox Code Playgroud)

提供初始尺寸有什么意义?

c# list

6
推荐指数
1
解决办法
6782
查看次数

标签 统计

c# ×1

list ×1