Advertisement
Guest User

Вызов делегатов

a guest
Feb 6th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.30 KB | None | 0 0
  1. private static void foobar(int a, int b)
  2. {
  3.     Console.WriteLine("{0}+{1}={2}", a, b, a + b);
  4. }
  5.  
  6. private static void wrap(Action<int, int> method, int a, int b)
  7. {
  8.     method.Invoke(a, b);
  9. }
  10.  
  11. static void Main()
  12. {
  13.     var b = new Action<int, int>(Program.foobar);
  14.     wrap(Program.foobar, 1, 2);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement