Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public delegate void SomeCalc(int a, int b);
- Action<int, int> ActionAdd = (a,b) => Console.WriteLine(string.Format("Addition result in Action: {0}", a + b));
- Action<int, int> ActionMult = (a,b) => Console.WriteLine(string.Format("Multiply result in Action: {0}", a * b));
- void Main()
- {
- var x = 5;
- var y = 6;
- var delAdd = new SomeCalc(Add);
- var delMultiply = new SomeCalc(Multiply);
- delAdd(x,y);
- delMultiply(x,y);
- ActionAdd(x,y);
- ActionMult(x,y);
- }
- public void Add(int c, int d) {
- Console.WriteLine(string.Format("Addition result: {0}", c + d));
- }
- public void Multiply(int e, int f) {
- Console.WriteLine(string.Format("Multiplication result: {0}", e * f));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement