using System.Collections; static void Main(string[] args) { TestArrayList(); } //------------------------------------------------------ // 动态数组(ArrayList) public static void TestArrayList() { ArrayList arr = new ArrayList(); arr.Add(1); arr.Add(5); arr.Add(3); Console.WriteLine("Capacity: {0} ", arr.Capacity); Console.WriteLine("Count: {0}", arr.Count); Console.Write("Content: "); foreach (int i in arr) { Console.Write(i + " "); } Console.WriteLine(); Console.Write("Sorted Content: "); arr.Sort(); foreach (int i in arr) { Console.Write(i + " "); } Console.WriteLine(); Console.ReadLine(); } //------------------------------------------------------