Juff-Ma

Program

Jul 18th, 2022 (edited)
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. void hello()
  2. {
  3.     Console.WriteLine("hello");
  4. }
  5.  
  6.  
  7. List<Delegate> methods = new();
  8.  
  9. methods.Add(() =>
  10. {
  11.     Console.WriteLine("hi");
  12. });
  13. methods.Add(() =>
  14. {
  15.     Console.WriteLine("hi2");
  16. });
  17. methods.Add(() =>
  18. {
  19.     Console.WriteLine("hi3");
  20. });
  21. methods.Add(() =>
  22. {
  23.     Console.WriteLine("hi4");
  24. });
  25. methods.Add(() =>
  26. {
  27.     Console.WriteLine("hi5");
  28. });
  29. methods.Add(() =>
  30. {
  31.     Console.WriteLine("hi6");
  32. });
  33. methods.Add(() =>
  34. {
  35.     Console.WriteLine("hi7");
  36. });
  37. methods.Add(() =>
  38. {
  39.     Console.WriteLine("hi8");
  40. });
  41. methods.Add(() =>
  42. {
  43.     Console.WriteLine("hi9");
  44. });
  45. methods.Add(() =>
  46. {
  47.     Console.WriteLine("hi10");
  48. });
  49.  
  50.  
  51. methods.Add(() => hello);
  52.  
  53. Parallel.ForEach(methods, method => { method.DynamicInvoke(); });
Add Comment
Please, Sign In to add comment