C# 在list的指定位置添加元素

使用Insert方法;

代码示例如下:

List<int> temp = new List<int>();
temp.Add(2);
temp.Add(3);
temp.Add(4);
temp.Insert(0,5);

temp结果为5,2,3,4

posted @ 2019-11-11 15:23  你小子嚣张呀  阅读(11502)  评论(0编辑  收藏  举报