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);
- }
- }
I would like to know why the output for del(2,8) is 10 instead of 2 - 8 which is -6.