C#如何向List<>中添加多个元素?

即完成以下工作
for (int i = list1.Count; i <n; i++) {
IsBankFree.Add(...);
}

慕田峪7331174
浏览 7169回答 1
1回答

Smart猫小萌

用AddRange这个方法,详见:// // 摘要: // 将指定集合的元素添加到 System.Collections.Generic.List<T> 的末尾。 // // 参数: // collection: // 一个集合,其元素应被添加到 System.Collections.Generic.List<T> 的末尾。集合自身不能为 null,但它可以包含为 // null 的元素(如果类型 T 为引用类型)。 // // 异常: // System.ArgumentNullException: // collection 为 null。 public void AddRange(IEnumerable<T> collection);
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python