5 internal static class AsyncHelper
7 public static readonly
Task DoneTask =
Task.FromResult(result:
true);
9 public static readonly
Task<bool> DoneTaskTrue =
Task.FromResult(result:
true);
11 public static readonly
Task<bool> DoneTaskFalse =
Task.FromResult(result:
false);
13 public static readonly
Task<int> DoneTaskZero =
Task.FromResult(0);
15 public static bool IsSuccess(
this Task task)
24 public static Task CallVoidFuncWhenFinish(
this Task task,
Action func)
31 return task._CallVoidFuncWhenFinish(func);
34 private static async
Task _CallVoidFuncWhenFinish(
this Task task,
Action func)
40 public static Task<bool> ReturnTaskBoolWhenFinish(
this Task task,
bool ret)
50 return task._ReturnTaskBoolWhenFinish(ret);
53 public static async
Task<bool> _ReturnTaskBoolWhenFinish(
this Task task,
bool ret)
59 public static Task CallTaskFuncWhenFinish(
this Task task, Func<Task> func)
65 return _CallTaskFuncWhenFinish(task, func);
68 private static async
Task _CallTaskFuncWhenFinish(
Task task, Func<Task> func)
71 await func().ConfigureAwait(continueOnCapturedContext:
false);
80 return task._CallBoolTaskFuncWhenFinish(func);
86 return await func().ConfigureAwait(continueOnCapturedContext:
false);
99 return _ContinueBoolTaskFuncWhenFalse(task, func);
108 return await func().
ConfigureAwait(continueOnCapturedContext:
false);
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
Configures an awaiter used to await this T:System.Threading.Tasks.Task`1.
TResult Result
Gets the result value of this T:System.Threading.Tasks.Task`1.
delegate void Action()
Encapsulates a method that has no parameters and does not return a value.
bool IsCompleted
Gets whether this T:System.Threading.Tasks.Task has completed.
AggregateException Exception
Gets the T:System.AggregateException that caused the T:System.Threading.Tasks.Task to end prematurely...
Represents an asynchronous operation that can return a value.