fork(2) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7.  
  8. public static void Main()
  9. {
  10. var actions = new List<Action>();
  11.  
  12. for (var i = 0; i<3; i++ )
  13. {
  14. actions.Add(() => Console.WriteLine(i));
  15. }
  16.  
  17. foreach (var action in actions)
  18. {
  19. action();
  20. }
  21. }
  22. }
Success #stdin #stdout 0.02s 22536KB
stdin
Standard input is empty
stdout
3
3
3