コード例 #1
0
        public static void Main()
        {
            Procedure someProc = null;  // this instantiates the delegate by creating a variable of type Procedure

            someProc += new Procedure(DelegateDemo.Method1);
            someProc += new Procedure(Method2);  // example without class name as not required cos we are in this class

            DelegateDemo demo = new DelegateDemo();

            someProc += new Procedure(demo.Method3);
            someProc();  // this calls the delgate instance
        }
コード例 #2
0
 public void TestMethod1()
 {
     DelegateDemo.Main();
 }