Open sandboxFocus

Class AwaiterAttribute

Binds a parameter of an OnMethodEntryAdvice or OnMethodResumeAdvice method to an awaiter that the async method awaits before it continues.

Inheritance
AwaiterAttribute
Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp.dll
Syntax
public sealed class AwaiterAttribute : AdviceParameterAttribute
Remarks

The parameter must be ref or out, and its type must implement INotifyCompletion or ICriticalNotifyCompletion. The advice assigns an awaiter to the parameter and sets the parameter bound by FlowBehaviorAttribute to Yield. The async method then awaits the awaiter before it continues, for instance to switch to another thread.

All the AwaiterAttribute parameters of the advices of one group must have the same type, because they share one variable. This attribute can be used only in OnMethodEntryAdvice and OnMethodResumeAdvice.

Constructors

Name Description
AwaiterAttribute()

See Also