Example #1
0
 delegate string MyDelegate();//声明委托
 static void Main(string[] args)
 {
     Helloworld hello = new Helloworld();
     MyDelegate h = new MyDelegate(hello.HelloCN);
     Console.WriteLine(h());
     h = new MyDelegate(hello.HelloEN);
     Console.WriteLine(h());
 }
Example #2
0
        delegate string MyDelegate();//声明委托

        static void Main(string[] args)
        {
            Helloworld hello = new Helloworld();
            MyDelegate h     = new MyDelegate(hello.HelloCN);

            Console.WriteLine(h());
            h = new MyDelegate(hello.HelloEN);
            Console.WriteLine(h());
        }