Advertisement
Venciity

[Jumpstart C#] two-dimesional array examples

Feb 25th, 2014
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace two_dimesional_array
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.  
  15.             // Вземане на стойност на елемент
  16.             int[,] myIntArray = new int [2,2]
  17.             {
  18.                 {1,2},
  19.                 {9,3}
  20.             };
  21.  
  22.             int element = myIntArray[1, 0];     // 9
  23.  
  24.  
  25.  
  26.  
  27.  
  28.             // втори пример за вземане на стойност на елемент
  29.             int[,] array = { { 1, 2 }, { 3, 4 } };
  30.             int element11 = array[1, 1]; // element11 = 4
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement