fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int variableLocal = 0;
  8.  
  9. // Captured variable:
  10. Func<int> delegado = () => variableLocal++;
  11.  
  12. Console.WriteLine (delegado()); // 0
  13. Console.WriteLine (delegado()); // 1
  14. Console.WriteLine (variableLocal); // 2
  15. }
  16. }
Success #stdin #stdout 0.03s 33904KB
stdin
Standard input is empty
stdout
0
1
2