using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace Array ...{ class Program ...{ staticvoid Main(string[] args) ...{ //使用ArrayList 前要引入命名空间System.Collections; ArrayList arr =new ArrayList(); string str1; while (true) ...{ Console.WriteLine("Add the word to ArrayList"); str1 = Console.ReadLine(); if (str1 =="end") break;//只有输入"end" ,才会跳出while arr.Add(str1); for (int i =0; i < arr.Count; i++) Console.Write("{0} ", arr[i]); Console.WriteLine(); } } } }