Skip to content

Instantly share code, notes, and snippets.

@TryJSIL
Created April 27, 2012 11:17
Show Gist options
  • Save TryJSIL/2508480 to your computer and use it in GitHub Desktop.
Save TryJSIL/2508480 to your computer and use it in GitHub Desktop.
Multidimensional Arrays
using System;
public static class Program {
public static void Main (string[] args) {
// [y, x], not [x, y]!
var a = new string[5, 10];
var h = a.GetLength(0);
var w = a.GetLength(1);
for (var y = 0; y < h; y++)
for (var x = 0; x < w; x++)
a[y, x] = String.Format("x={0}, y={1}", x, y);
foreach (var s in a)
Console.WriteLine(s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment