c#dalegate invoke及AsyncCallback使用

时间:2024-01-13 09:30:38

public delegate void AsyncDelegate();
        private AsyncDelegate asyncDl;

asyncDl = new AsyncDelegate(() =>
                {
                   //todo
                });

AsyncCallback callBack = new AsyncCallback((s) =>
                {

//todo
                });

asyncDl.BeginInvoke(callBack, null); //启动执行

当异步方法执行完毕会调用callBack方法