fork download
  1. using System;
  2.  
  3. class IndexerClass
  4. {
  5. public int this [int index] // Indexer declaration
  6. {
  7. get
  8. {
  9. Console.WriteLine("GET {0}", index);
  10. return 0;
  11. }
  12. set
  13. {
  14. Console.WriteLine("SET {0} {1}", index, value);
  15. }
  16. }
  17. }
  18.  
  19. public class MainClass
  20. {
  21. public static void Main()
  22. {
  23. IndexerClass b = new IndexerClass();
  24.  
  25. int x = ++b[5];
  26.  
  27. Console.WriteLine("x={0}", x);
  28. }
  29. }
Success #stdin #stdout 0.03s 36968KB
stdin
Standard input is empty
stdout
GET 5
SET 5 1
x=1