コード例 #1
0
        static void Main()
        {
            DelegateGreeting del = x => { Console.WriteLine("Welcome {0} to {1}", "Arab", x); System.Threading.Thread.Sleep(1000); return(2); };

            IAsyncResult AsycRes = del.BeginInvoke("California", CallBackMethod, null);

            Console.ReadLine();
        }
コード例 #2
0
        static void Main()
        {
            DelegateGreeting del = x => { Console.WriteLine("Welcome {0} to {1}", "Arab", x); System.Threading.Thread.Sleep(2000); };

            IAsyncResult AsycCall = del.BeginInvoke("California", null, null);

            del.EndInvoke(AsycCall);
            Console.WriteLine("Asyc call finished");
        }
コード例 #3
0
        static void Main()
        {
            DelegateGreeting del = x => Console.WriteLine("Welcome {0} to {1}", "Arab", x);

            del += x => Console.WriteLine("Welcome {0} to {1}", "Bob", x);

            //del.Invoke("California");
            del("New York");
        }