Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
TaskExtensions.cs
Go to the documentation of this file.
3
4namespace System.Net;
5
6internal static class TaskExtensions
7{
8 public static TaskCompletionSource<TResult> ToApm<TResult>(this Task<TResult> task, AsyncCallback callback, object state)
9 {
11 task.ContinueWith(delegate(Task<TResult> completedTask)
12 {
13 bool flag = false;
14 flag = (completedTask.IsFaulted ? tcs.TrySetException(completedTask.Exception.InnerExceptions) : ((!completedTask.IsCanceled) ? tcs.TrySetResult(completedTask.Result) : tcs.TrySetCanceled()));
15 if (flag && callback != null)
16 {
17 callback(tcs.Task);
18 }
20 return tcs;
21 }
22}
ReadOnlyCollection< Exception > InnerExceptions
static TaskCompletionSource< TResult > ToApm< TResult >(this Task< TResult > task, AsyncCallback callback, object state)
AggregateException? Exception
Definition Task.cs:1014