program.cs
来自「c#开发宝典 光盘内容。本光盘主要为书中的源程序」· CS 代码 · 共 32 行
CS
32 行
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace Example9_14 {
class Program {
static void Main(string[] args) {
ArrayList myArrayList = new ArrayList(3);
myArrayList.Add("Hello ");
myArrayList.Add("World!");
//分别在索引值为1和2的地方插入“Jack”和“This is the”字符串
myArrayList.Insert(1, "Jack ");
myArrayList.Insert(2, "This is the ");
//分别输出myArrayList的容量和元素个数。
Console.WriteLine("Capacity: {0}", myArrayList.Capacity);
Console.WriteLine("Count: {0}", myArrayList.Count);
//输出myArrayList的4个元素。
Console.WriteLine(myArrayList[0]);
Console.WriteLine(myArrayList[1]);
Console.WriteLine(myArrayList[2]);
Console.WriteLine(myArrayList[3]);
Console.ReadLine();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?