Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.36 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Access Array with an Array of Indices
  2. int[,] map = sampleMap;
  3. int[] position = { 1, 2 };
  4.  
  5. sampleObject = map[position]; // This line won't work. "cannot implicitly convert type 'int[]' to 'int'"
  6.        
  7. sampleObject = map[position[1], position[2]]
  8.        
  9. map[position[1], position[2], position[3], ..., position[10]]
  10.        
  11. map[position]
  12.        
  13. 26 / 20 = 1
  14. 26 % 20 - 1 = 5