PostSharp6.6//API Reference/Post­Sharp.​Aspects Namespace/IOn­State­Machine­Boundary­Aspect Interface/IOn­State­Machine­Boundary­Aspect Methods/IOn­State­Machine­Boundary­Aspect.​On­Yield Method

IOnStateMachineBoundaryAspect.OnYield Method

Method executed when a state machine yields, as the result of a yield return or await statement.

Namespace:  PostSharp.Aspects
Assembly:  PostSharp (in PostSharp.dll) Version: 6.6.7.0 (6.6.7.0)
Syntax
C#
void OnYield(
	MethodExecutionArgs args
)

Parameters

args
Type: PostSharp.Aspects.MethodExecutionArgs
Event arguments specifying which method is being executed and which are its arguments. In iterator methods, the YieldValue property gives access to the operand of the yield return statement.
Remarks

In iterator methods, this advise is exactly executed at the yield return statement.

In async methods, the advice is executed just after the state machine starts waiting as a result of the await statement. In case the operand of the await statement is an operation that completed synchronously, the state machine does not yield, and the OnYield(MethodExecutionArgs) advise won't be invoked.

See Also