string[] A = new string[5] { "a1","a2","a3","a4","a5"}; //第一种方法 for (int i = 0; i < A.Length; i++) { Console.WriteLine(A[i]); } //第二种方法 IEnumerator e= A.GetEnumerator(); while (e.MoveNext()) { Console.WriteLine(e.Current.ToString()); } //第三种方法 foreach (string s in A) { Console.WriteLine(s); }
时间: 2024-10-10 15:50:51