TaskUtils
Assembly: ServiceStack.Text.dll
View Source
Declaration
public static class TaskUtils
Methods
FromResult<T>(T)
View Source
Declaration
public static Task<T> FromResult<T>(T result)
Returns
System.Threading.Tasks.Task<<T>>
Parameters
Type | Name |
---|---|
<T> | result |
Type Parameters
T
InTask<T>(T)
View Source
Declaration
public static Task<T> InTask<T>(this T result)
Returns
System.Threading.Tasks.Task<<T>>
Parameters
Type | Name |
---|---|
<T> | result |
Type Parameters
T
InTask<T>(Exception)
View Source
Declaration
public static Task<T> InTask<T>(this Exception ex)
Returns
System.Threading.Tasks.Task<<T>>
Parameters
Type | Name |
---|---|
System.Exception | ex |
Type Parameters
T
IsSuccess(Task)
View Source
Declaration
public static bool IsSuccess(this Task task)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Threading.Tasks.Task | task |
Cast<From, To>(Task<From>)
View Source
Declaration
public static Task<To> Cast<From, To>(this Task<From> task)
where To : From
Returns
System.Threading.Tasks.Task<<To>>
Parameters
Type | Name |
---|---|
System.Threading.Tasks.Task<<From>> | task |
Type Parameters
From
To
SafeTaskScheduler()
View Source
Declaration
public static TaskScheduler SafeTaskScheduler()
Returns
System.Threading.Tasks.TaskScheduler
Then<From, To>(Task<From>, Func<From, To>)
View Source
Declaration
public static Task<To> Then<From, To>(this Task<From> task, Func<From, To> fn)
Returns
System.Threading.Tasks.Task<<To>>
Parameters
Type | Name |
---|---|
System.Threading.Tasks.Task<<From>> | task |
System.Func<<From>,<To>> | fn |
Type Parameters
From
To
Then(Task, Func<Task, Task>)
View Source
Declaration
public static Task Then(this Task task, Func<Task, Task> fn)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.Threading.Tasks.Task | task |
System.Func<System.Threading.Tasks.Task,System.Threading.Tasks.Task> | fn |
EachAsync<T>(IEnumerable<T>, Func<T, Int32, Task>)
View Source
Declaration
public static Task EachAsync<T>(this IEnumerable<T> items, Func<T, int, Task> fn)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<<T>> | items |
System.Func<<T>,System.Int32,System.Threading.Tasks.Task> | fn |
Type Parameters
T
Sleep(Int32)
View Source
Declaration
public static void Sleep(int timeMs)
Parameters
Type | Name |
---|---|
System.Int32 | timeMs |
Sleep(TimeSpan)
View Source
Declaration
public static void Sleep(TimeSpan time)
Parameters
Type | Name |
---|---|
System.TimeSpan | time |