Table of Contents

Class AsyncHelper

Namespace
Volo.Abp.Threading
Assembly
Volo.Abp.Core.dll

Provides some helper methods to work with async methods.

public static class AsyncHelper
Inheritance
AsyncHelper
Inherited Members

Methods

IsAsync(MethodInfo)

Checks if given method is an async method.

public static bool IsAsync(this MethodInfo method)

Parameters

method MethodInfo

A method to check

Returns

bool

IsTaskOfT(Type)

public static bool IsTaskOfT(this Type type)

Parameters

type Type

Returns

bool

IsTaskOrTaskOfT(Type)

public static bool IsTaskOrTaskOfT(this Type type)

Parameters

type Type

Returns

bool

RunSync(Func<Task>)

Runs a async method synchronously.

public static void RunSync(Func<Task> action)

Parameters

action Func<Task>

An async action

RunSync<TResult>(Func<Task<TResult>>)

Runs a async method synchronously.

public static TResult RunSync<TResult>(Func<Task<TResult>> func)

Parameters

func Func<Task<TResult>>

A function that returns a result

Returns

TResult

Result of the async operation

Type Parameters

TResult

Result type

UnwrapTask(Type)

Returns void if given type is Task. Return T, if given type is Task{T}. Returns given type otherwise.

public static Type UnwrapTask(Type type)

Parameters

type Type

Returns

Type