fork download
  1. using System;
  2.  
  3. namespace ArrayTest
  4. {
  5. class Program
  6. {
  7. public static Drawable[] drawableArray;
  8. public static Drawable drawable;
  9.  
  10. static void Main(string[] args)
  11. {
  12. drawable = new Drawable() { x = 0, y = 0 };
  13.  
  14. drawableArray = new Drawable[1];
  15. drawableArray[0] = drawable;
  16.  
  17. Console.WriteLine(drawableArray[0].x); // will print 0
  18.  
  19. drawable.x = 2;
  20.  
  21. Console.WriteLine(drawableArray[0].x); // will print 2
  22.  
  23. Console.ReadLine();
  24. }
  25. }
  26.  
  27. class Drawable
  28. {
  29. public int x;
  30. public int y;
  31. }
  32. }
Success #stdin #stdout 0.03s 34712KB
stdin
Standard input is empty
stdout
0
2