AsyncResult类没有进入回调函数

时间:2010-12-29 12:36:56

标签: asynchronous delegates

这里是我的代码 -

DateTimeDelegate dtdel = new DateTimeDelegate(GetCurrentDateTimeAt);
IAsyncResult async = dtdel.BeginInvoke(UserContext.Latitude.ToString(), UserContext.Longitude.ToString(), new AsyncCallback(DateTimeCallBack), null);  

...

public DateTimeCallBack(IAsyncResult asy)
    {
        AsyncResult result = (AsyncResult)asy; // error 'AsyncResult' could not be found

    }

我该怎么办?

1 个答案:

答案 0 :(得分:1)

AsyncResult类在System.Runtime.Remoting.Messaging命名空间中定义。确保你已经包含它。您也可以在MSDN上结帐following article