fork download
  1. using System;
  2. class A
  3. {
  4. private EventHandler click;
  5. public event EventHandler Click
  6. {
  7. add { click += value; }
  8. remove { click -= value; }
  9. }
  10. public void PerformClick()
  11. {
  12. click(this, new EventArgs());
  13. }
  14. }
  15. class B
  16. {
  17. public void foo()
  18. {
  19. Console.WriteLine("b.foo()");
  20. }
  21. }
  22. public class Test
  23. {
  24. public static void Main()
  25. {
  26. A a = new A();
  27. B b = new B();
  28. a.Click += new EventHandler((se, ar) => { b.foo(); });
  29. a.PerformClick();
  30. }
  31. }
Success #stdin #stdout 0.02s 24096KB
stdin
Standard input is empty
stdout
b.foo()