Skip to content

Instantly share code, notes, and snippets.

@ichiroku11
Created October 2, 2018 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ichiroku11/92bd4f6ab5623216b693efbf40bb5ca2 to your computer and use it in GitHub Desktop.
Save ichiroku11/92bd4f6ab5623216b693efbf40bb5ca2 to your computer and use it in GitHub Desktop.
2次元配列
using System;
namespace ConsoleApp {
class Program {
static void Main(string[] args) {
var matrix = new string[,] {
{ "1-1", "1-2", "1-3" },
{ "2-1", "2-2", "2-3" }
};
for (var x = 0; x < matrix.GetLength(0); x++) {
for (var y = 0; y < matrix.GetLength(1); y++) {
Console.WriteLine(matrix[x, y]);
}
}
/*
1-1
1-2
1-3
2-1
2-2
2-3
*/
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment