异步编程1-异步委托

static void Main(string[] args)
        {
            Func<int, int, int> addFunc = (a, b) => a+b;

            addFunc.BeginInvoke(5, 6, new AsyncCallback((ar) =>
            {
                var func= ar.AsyncState as Func<int, int, int>;
                Console.WriteLine(func.EndInvoke(ar));
            }), addFunc);

            Console.ReadKey();
        }

posted @ 2015-01-13 18:27  张小军  阅读(322)  评论(0编辑  收藏  举报