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