Open sandboxFocus

Method GetAsyncInfo

GetAsyncInfo(IMethod)

Gets information about the async characteristics of a method, including whether it is awaitable and its result type.

Declaration
[CompileTime]
public static AsyncInfo GetAsyncInfo(this IMethod method)
Parameters
Type Name Description
IMethod method

The method to inspect.

Returns
Type Description
AsyncInfo

An AsyncInfo containing information about the async characteristics of the method, including whether it has the async modifier, whether its return type is awaitable, and the unwrapped result type.

Remarks

This method is useful for aspects that need to inspect async method properties at compile time, for example in BuildAspect.

The ResultType property returns the unwrapped result type. For example, for a method returning Task<string>, the ResultType is string.

See Also