Exemple #1
0
        static void Main(string[] args)
        {
            var d           = new MyAction(xxx);
            var asyncResult = d.BeginInvoke(2000, ad, d);

            Console.WriteLine("委托内的方法正在执行中");
            //while (!asyncResult.AsyncWaitHandle.WaitOne(100, false))
            //{
            //    Console.Write("*");
            //}
            //var result = d.EndInvoke(asyncResult);
            //d.BeginInvoke(h => { Console.WriteLine("返回值是{0}", d.EndInvoke(h).result); }, null);
            //Console.WriteLine("返回值是{0}", result.result);
            Console.ReadKey();
        }