Trying to iterate over arrays through foreach : Error
int[][] anArray = {new int[] {123,432}, new int[] {543,542}}; foreach (int i in anArray) //ΠΎΡΠΈΠ±ΠΊΠ° foreach (int j in anArray[i]) Console.WriteLine(anArray[i][j]); Console.ReadKey(); But when iterating through for everything is fine
int[][] anArray = {new int[] {123,432}, new int[] {543,542}}; for (int i = 0; i < anArray.Length; i++) for (int j = 0; j < anArray[i].Length; j++) Console.WriteLine(anArray[i][j]); Console.ReadKey(); What's the matter?