【发布时间】:2013-12-13 13:35:58
【问题描述】:
通用列表中是否有一个内置函数可以从特定索引中添加另一个列表中的范围,还是我必须自己编写?
例如:
List<int> list1 = new List<int>();
List<int> list2 = new List<int>();
list1.Add(10);
list1.Add(20);
list1.Add(30);
list2.Add(100);
//list2.AddRange(list1, 1) Add from list1 from the index 1 till the end
在本例中,list2 应包含 3 个元素:100、20 和 30。
我应该自己写还是有一个内置函数可以做到这一点?
【问题讨论】:
-
@Shyju 他已经知道
AddRange()..