//获取元素的索引 ArrayList arrList = new ArrayList(); for (int i = 0; i < array.Length; i++) { if (array[i] == 8) { arrList.Add(i); } }var newArray = arrList.ToArray(); Console.WriteLine("[{0},{1}]", newArray[0], newArray[1]);
//获取元素的索引 ArrayList arrList = new ArrayList(); for (int i = 0; i < array.Length; i++) { if (array[i] == 8) { arrList.Add(i); } }var newArray = arrList.ToArray(); Console.WriteLine("[{0},{1}]", newArray[0], newArray[1]);