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