.NET 集合类:ArrayList 与 Stack 的深入解析
1. ArrayList 操作
1.1 插入一系列元素
InsertRange 方法与 Add 方法有所不同,它可以从 _items 数组的指定位置开始,向 ArrayList 中添加一系列元素。以下是一个示例代码:
using System;
using System.Collections;
using System.Collections.Generic;
namespace Ch11
{
class Program
{
static void Main(string[] args)
{
ArrayList numbers = new ArrayList()
{
0,1, 2, 3
};
numbers.InsertRange(3, new List<int>() { 22, 33, 77 });
ShowResult(numbers);
}
public static void ShowResult(IEnumerable aList)
{
foreach (var item in aList)
Console.W
超级会员免费看
订阅专栏 解锁全文
4388

被折叠的 条评论
为什么被折叠?



