Example #1
0
        static void Main3()
        {
            MyDelegate d1 = new MyDelegate(f1);
            MyMath m1 = new MyMath();
            MyMathDelegate d2 = new MyMathDelegate(m1.Addition);
            d2 += m1.Subtraction;
            d2 += m1.Multiplication;
            //Multicast delegate

            Test(d1, d2);
        }
Example #2
0
 static void Main()
 {
     MyMath m1 = new MyMath();
     MyMathDelegate d1 = new MyMathDelegate(m1.Addition);
     MyMathDelegate d2 = new MyMathDelegate(m1.Subtraction);
     MyMathDelegate d3 = new MyMathDelegate(m1.Multiplication);
     e2 += d1;
     e2 += d2;
     e2 += d3;
     Console.WriteLine(e2(10, 20));
 }
Example #3
0
 static void Main2(string[] args)
 {
     MyMath m1 = new MyMath();
     MyMathDelegate d1 = new MyMathDelegate(m1.Addition);
     Console.WriteLine(d1(10, 20));
 }