我已经反编译了.NET应用程序,并且它给我返回的代码是错误的,而且我不知道如何替换它。 这些是一些错误的行:
if (((TaskAwaiter<HttpResponseMessage>) ref awaiter1).get_IsCompleted()) {...}
if (((TaskAwaiter<Uri>) ref awaiter2).get_IsCompleted()) {...}
它带给我的错误是“无效的表达式术语'ref'。” 谁能帮我吗?谢谢
答案 0 :(得分:0)
检查任务(在条件之前调用任务)是否已经完成。例如
HttpClient httpClient = new HttpClient();
var result = await httpClient.GetStringAsync(url);
等于
this.<httpClient>5__1 = new HttpClient();
taskAwaiter = this.<httpClient>5__1.GetStringAsync(this.url).GetAwaiter();
if (!taskAwaiter.get_IsCompleted())
{
//...
}