Dear experts,
I have this multi-cast delegate which I am having problem understand:
- delegate void M(int x, int y);
- public class Oper
- {
- public static void Add(int x, int y)
- {
- Console.WriteLine("{0} + {1} = {2}", x, y, x+y);
- }
- public static void Sub(int x, int y)
- {
- Console.WriteLine("{0} + {1} = {2}", x, y, x+y);
- }
- public class CSharpApp
- {
- static void Main()
- {
- M del = new M(Oper.Add);
- del += new M(Oper.Sub);
- del(6,4);
- del -= new M(Oper.Sub);
- del(2,8);
- }
- }
Nitin SontakkePosted Nov 9, 2016, 8:35 PM
Tangara GPosted Nov 10, 2016, 2:23 AM
Tangara GPosted Nov 9, 2016, 8:24 PM
Nitin SontakkePosted Nov 9, 2016, 4:11 AM
Nitin SontakkePosted Nov 9, 2016, 4:08 AM
Tangara GPosted Nov 9, 2016, 2:23 AM
Nitin SontakkePosted Nov 8, 2016, 10:16 PM