前田稔(Maeda Minoru)の超初心者のプログラム入門
delegate void TestDelegate(); Class1 class1 = new Class1(); TestDelegate testdelegate = new TestDelegate( class1.method ); Console.WriteLine( testdelegate.Method.Name ); Console.WriteLine( testdelegate.Method.CallingConvention ); Console.WriteLine( testdelegate.Method.ReturnType ); Console.WriteLine( testdelegate.Target.GetType().FullName ); Console.WriteLine( testdelegate.Target.GetType().Attributes ); |
/*************************************************/ /*★ メソッド名やクラス名を表示する 前田 稔 ★*/ /*************************************************/ using System; namespace ConsoleApp { delegate void TestDelegate(); class Class1 { public void method() { Console.WriteLine( "Hello!" ); } static void Main() { Class1 class1 = new Class1(); TestDelegate testdelegate = new TestDelegate( class1.method ); Console.WriteLine( testdelegate.Method.Name ); Console.WriteLine( testdelegate.Method.CallingConvention ); Console.WriteLine( testdelegate.Method.ReturnType ); Console.WriteLine( testdelegate.Target.GetType().FullName ); Console.WriteLine( testdelegate.Target.GetType().Attributes ); Console.ReadLine(); } } } |