0
/// <summary>
/// Delegate for executing an asynchronous request.
/// </summary>
public delegate void ExecuteRequestDelegate<T>(LazyResult<T> response);
public void FetchAsync([Optional] ExecuteRequestDelegate<TResponse> methodToCall)
{
GetAsyncResponse(
(IAsyncRequestResult state) =>
{
var result = new LazyResult<TResponse>(() =>
{
// Retrieve and convert the response.
IResponse response = state.GetResponse();
return FetchObject(response);
});
// Only invoke the method if it was set.
if (methodToCall != null)
{
methodToCall(result);
}
else
{
result.GetResult();
}
});
}
我想打電話給現在FetchAsync
,但我不知道我怎麼C#FetchAsync和委託調用在方法
service.Userinfo.Get().FetchAsync(new ExecuteRequestDelegate<Userinfo>() {...});
,然後取回該ExecuteRequestDelegate不包含一個構造函數參數0。
我該怎麼辦?我想獲得Userinfo
數據?
精湛。感謝yolu的解釋 – senzacionale