Skip to main content

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
TypeName
<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
TypeName
<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
TypeName
System.Exceptionex
Type Parameters
  • T

IsSuccess(Task)

View Source
Declaration
public static bool IsSuccess(this Task task)
Returns

System.Boolean

Parameters
TypeName
System.Threading.Tasks.Tasktask

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
TypeName
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
TypeName
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
TypeName
System.Threading.Tasks.Tasktask
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
TypeName
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
TypeName
System.Int32timeMs

Sleep(TimeSpan)

View Source
Declaration
public static void Sleep(TimeSpan time)
Parameters
TypeName
System.TimeSpantime