首页 > 代码库 > 异步编程1-异步委托

异步编程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();
        }

异步编程1-异步委托