示例#1
0
        public static void Main(string[] args)
        {
            Program         p  = new Program();
            AddNumsDelegate ad = new AddNumsDelegate(p.AddNums); // Instance Method

            // ad(100, 50);
            ad.Invoke(100, 50);

            SayHelloDelegate shd = new SayHelloDelegate(SayHello); // Static Method

            string str = shd("Raju");                              // shd.Invoke("Raju");

            Console.WriteLine(str);
        }
        static void Main(string[] args)
        {
            AddNumsDelegate obj1 = AddNums;
            double          b    = obj1.Invoke(100, 3.9f, 200);

            Console.WriteLine(b);

            NamesDelegate obj2 = Names;

            obj2.Invoke("laxman");

            DecisionsDelegates obj3 = Decision;
            bool t = obj3.Invoke("laxman");

            Console.WriteLine(t);
            Console.Read();
        }