Exemple #1
0
        static void Main(string[] args)
        {
            int a = 12345;

            int[] arr1 = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 99 };
            int[] arr2 = { 11, 22, 30, 73, 50, 60, 70, 30, 78, 14 };


            Del1 del1 = Class1.IntToArr;
            Del2 del2 = Class1.Print;

            del1.Invoke(a);
            del2.Invoke(del1.Invoke(a));
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Del1 d1 = Method1;
            Del2 d2 = Method2;
            int  a  = 39854;

            int[] arr1 = new int[] { 45, 23, 98, 23, 89, 34, 78, 53, 21, 12 };
            int[] arr2 = d1?.Invoke(a);
            d2?.Invoke(arr1);
            d2?.Invoke(arr2);
            Console.WriteLine(d1.Target);
            Console.WriteLine(d1.Method);
            Console.WriteLine(d2.Target);
            Console.WriteLine(d2.Method);
        }
        static void Main(string[] args)
        {
            var M1 = new Matematic();

            Console.Out.WriteLine("Vvedite X");
            int x = Int32.Parse(Console.ReadLine());

            Console.Out.WriteLine("Vvedite Y");
            int          y = Int32.Parse(Console.ReadLine());
            DelegateTest Del1;

            if (Console.ReadLine() == "+")
            {
                Del1 = M1.Sum; Console.Out.WriteLine(Del1.Invoke(x, y));
            }
            else if (Console.ReadLine() == "*")
            {
                Del1 = M1.Mult; Console.Out.WriteLine(Del1.Invoke(x, y));
            }

            Console.ReadLine();
        }