fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. List<Action> actionList = new List<Action>();
  9. string testParamter = "Testing!";
  10.  
  11. Console.WriteLine("Started adding");
  12. actionList.Add(() => TestFunction(testParamter));
  13. Console.WriteLine("Finished adding");
  14.  
  15. Console.WriteLine("Started executing");
  16. foreach(Action action in actionList)
  17. {
  18. action();
  19. }
  20. Console.WriteLine("Finished executing");
  21.  
  22. }
  23.  
  24. public static void TestFunction(string parameter)
  25. {
  26. Console.WriteLine("Executed: " + parameter);
  27. }
  28. }
Success #stdin #stdout 0.03s 33872KB
stdin
Standard input is empty
stdout
Started adding
Finished adding
Started executing
Executed: Testing!
Finished executing