摘要:(2010-08-02) C#.NET ArrayList
桯式碼
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace mod02 { class Program { static void Main(string[] args) { System.Collections.ArrayList list = new System.Collections.ArrayList(); list.Add("eric"); list.Add(100); list.Add("linda"); //插入 list.Insert(0, "bill"); foreach (object o in list) { System.Console.WriteLine(o.ToString()); } Int32 r = list.IndexOf("linda"); System.Console.WriteLine(r.ToString()); //次數迴圈 for (Int32 i1 = 0; i1 < list.Count; i1++) { System.Console.WriteLine(list[i1].ToString()); } //有順序集合跟陣列一線之隔 Object[] ob = list.ToArray(); } } }