program.cs

来自「c#开发宝典 光盘内容。本光盘主要为书中的源程序」· CS 代码 · 共 28 行

CS
28
字号
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace Example9_15 {
    class Program {
        static void Main(string[] args) {
            ArrayList myArrayList = new ArrayList(3);

            myArrayList.Add("Hello ");
            myArrayList.Add("World!");
            Console.WriteLine("Capacity: {0}", myArrayList.Capacity);
            Console.WriteLine("Count: {0}", myArrayList.Count);

            //清除myArrayList中所有元素。
            myArrayList.Clear();
            Console.WriteLine("After Cleared");

            //输出myArrayList的容量和元素个数。
            Console.WriteLine("Capacity: {0}", myArrayList.Capacity);
            Console.WriteLine("Count: {0}", myArrayList.Count);

            Console.ReadLine();
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?