1. Foreach
2. ArrayList.Adapter.
3. ArrayList to Array. 强制转换Array result = (int[])arrayList.ToArray(typeof(int))
View Code
class Program { static void Main(string[] args) { int[] arrayInt = new int[] { 1, 2, 3, 4 }; ArrayList arrlistInt = new ArrayList(); //方法一 foreach (int a in arrayInt) { arrlistInt.Add(a); } Console.WriteLine(arrlistInt[2].ToString());//输出3 //方法二: ArrayList arrlistInt2 = ArrayList.Adapter(arrayInt); Console.WriteLine(arrlistInt2[2].ToString());//输出3 //逆向转换 Array resultArr = (int[])arrlistInt2.ToArray(typeof(int)); Console.WriteLine(resultArr.GetValue(2));//输出3 } }