Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Unwrap< TResult >()

static Task< TResult > System.Threading.Tasks.TaskExtensions.Unwrap< TResult > ( this Task< Task< TResult > > task)
inlinestatic

Definition at line 27 of file TaskExtensions.cs.

28 {
29 if (task == null)
30 {
31 throw new ArgumentNullException("task");
32 }
33 Task<TResult> task2;
34 if (task.IsCompletedSuccessfully)
35 {
36 task2 = task.Result;
37 if (task2 == null)
38 {
39 return Task.FromCanceled<TResult>(new CancellationToken(canceled: true));
40 }
41 }
42 else
43 {
44 task2 = Task.CreateUnwrapPromise<TResult>(task, lookForOce: false);
45 }
46 return task2;
47 }

References System.Threading.Tasks.Task< TResult >.FromCanceled(), System.Threading.Tasks.Task< TResult >.Result, and System.task.