Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
CSharp /
20180406cArrays, matricesint[] scores = new int[10]; // [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] int[] values = new int[] { 2, 5, 8, 3 }; // [2, 5, 8, 3] WriteLine(values.Length); // 4 int[] points = { 2, 5, 8, 3 }; // [2, 5, 8, 3] , with an array initializer (*) int[,] matrix = new int[2, 3]; int[,] m2 = { { 1, 2, 3 }, { 4, 5, 6 } }; for (int row = 0; row < m2.GetLength(0); ++row) { for (int col = 0; col < m2.GetLength(1); ++col) { Write(m2[row, col] + " "); } WriteLine(); } // simplest way (*) var wins = new[] { 3, 5, 7, 8 }; // [3, 5, 7, 8] The asterisks (*) indicate the preferred ways. |
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |