我有以下内容:
- 名为 GlobalStrings 的主列表
- 另一个名为 localStrings 的列表
以循环为例:
List<string> GlobalStrings = new List<string>();
List<string> localStrings = new List<string>();
for(x=1;x<10;x++)
{
localStrings.Add("some value");
localStrings.Add("some value");
}
// Want to append localStrings to GlobalStrings as easily as possible
GlobalStrings.AddRange(localStrings);
注意:您不能使用接口 (IList) 声明列表对象。
文档:List<T>.AddRange(IEnumerable<T>).
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)