fork download
  1. using System;
  2.  
  3. namespace Callback
  4. {
  5. public class TestCallbacks
  6. {
  7. public Action<int, bool, decimal, decimal, bool> TestCallback;
  8. }
  9.  
  10. public static class TestClass
  11. {
  12. public static TestCallbacks Callbacks;
  13.  
  14. public static void Initialize(TestCallbacks callbacks)
  15. {
  16. Callbacks = callbacks;
  17. }
  18.  
  19. public static void TestCallback()
  20. {
  21. // Passing i = 100!
  22. Callbacks.TestCallback(100, true, 200m, 300m, false);
  23. }
  24. }
  25.  
  26. class Program
  27. {
  28. private static void TestFunction(int i, bool b1, decimal d1, decimal d2, bool b2)
  29. {
  30. Console.WriteLine($"TestFunction, i = {i}!!!");
  31. }
  32.  
  33. static void Main(string[] args)
  34. {
  35. Console.WriteLine("Test begin...");
  36.  
  37. var testCallbacks = new TestCallbacks()
  38. {
  39. TestCallback = TestFunction
  40. };
  41.  
  42. TestClass.Initialize(testCallbacks);
  43.  
  44. TestClass.TestCallback();
  45. }
  46. }
  47. }
Success #stdin #stdout 0s 131520KB
stdin
Standard input is empty
stdout
Test begin...
TestFunction, i = 100!!!