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