Iterate Multi-Dimensional Array with Nested Foreach Statement

Posted by Tyler Murry on Stack Overflow See other posts from Stack Overflow or by Tyler Murry
Published on 2010-05-23T20:23:18Z Indexed on 2010/05/23 20:30 UTC
Read the original article Hit count: 386

I think this might be a pretty simple question, but I haven't been able to figure it out yet. If I've got a 2-dimensional array like so:

int[,] = new int[2,3] { {1, 2, 3}, {4, 5, 6} };

What's the best way to iterate through each dimension of the array with a nested foreach statement?

© Stack Overflow or respective owner

Related posts about c#

Related posts about best-practices