格式
typescript
List.Insert(index, item)所属类: List
描述
在列表中的指定索引位置插入元素。
参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| index | number | 索引值 |
| item | T | 元素值 |
返回值
| 类型 | 描述 |
|---|---|
void |
代码示例
typescript
let list = new List<Number>(Number);
list.AddRange([100, 200]);
//在索引值 2 处插入值 300
list.Insert(2,300);
for (let index = 0; index < list.count; index++) {
Debug.Log(list.get(index));
}