fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5.  
  6. delegate void Foo();
  7.  
  8. struct Bar {
  9. public int X;
  10. public void DoIt() {
  11. X++;
  12. Console.WriteLine("X={0}", X);
  13. }
  14. }
  15. public static void Main() {
  16. Bar b = new Bar();
  17. var foo = new Foo(b.DoIt);
  18. foo();
  19. foo();
  20. foo();
  21. Console.WriteLine("X={0} What???", b.X);
  22. }
  23.  
  24. }
Success #stdin #stdout 0.01s 131648KB
stdin
Standard input is empty
stdout
X=1
X=2
X=3
X=0 What???