1、1. 2. 6333. abcab621. 2. 3. 20152015?1;2;3;412-3()456-1();2;3-;4. ();5. ;6;7_ _- xx (xx, xx_ 1 ;2 ;3 ;4 -;5 ; ;xxxxxxxxxxxxxxx;xxxxxxxxxxxxxxx ()xxxxxxxxxxxxxxx xxxx,xx- xxx xxx 2010xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxx ooxx xxxx 2009-05-27 13:45:2612-3412-3456781234? ();();()()-;();()(-);()cc#cc+,
2、cc+c#1c#delegate delegate 2newnulldelegate void mydelegate(int x);class myclasspublic static void method1(int i)public void method2(int i)class testclassstatic void main()/mydelegate delegate1=new mydelegate(myclass.method1);/testclass class1=new myclass();mydelegate delegate2=new mydelegate(myclass
3、.method2);/mydelegate delegate3=new mydelegate(delegate2);3namespace delegatetestpublic delegate int mydelegatetest(int i,int j);class calculatepublic static int add(int i,int j)return i+j;public static int minus(int i,int j)return i-j;class delegateappstatic void main(string args)mydelegatetest d0=
4、new mydelegatetest(calculate.add);/mydelegatetestd0calculate.addint i=d0(99,1);/calculate.add(int i,int j)system.console.writeline(add:0,i);mydelegatetest d1=new mydelegatetest(calculate.minus);int j=d1(100,99);system.console.writeline(minus:0,j);system.console.readline(); - - 12345678. 123-456 242012912014831 -