Skip to content

Commit

Permalink
remove Wait()
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang committed Jan 22, 2018
1 parent e368b9f commit 1b22f34
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions WebApiClient/TaskExtend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,5 @@ public static ITask<TResult> HandleAsDefaultWhenException<TResult>(this ITask<TR
};
return task.Handle().WhenCatch<Exception>(func);
}


/// <summary>
/// 使用工作线程包装请求并同步等待结果
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <param name="task"></param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public static TResult Wait<TResult>(this ITask<TResult> task)
{
if (task == null)
{
throw new ArgumentNullException(nameof(task));
}
return Task.Run(() => task.InvokeAsync().Result).Result;
}
}
}

0 comments on commit 1b22f34

Please sign in to comment.