Skip to content
Concord

Enum PatchBody

Namespace
Concord
Assembly
Concord.Emit.dll

Selects which body an injection attaches to when the target is an async or iterator method. The C# compiler splits those into two methods: the declared one, which just builds and returns the state machine, and the state machine's MoveNext, which holds the body that was written.

public enum PatchBody

Fields

Declared = 0

Patch the method as declared (default). For an async or iterator target this is the stub the compiler emits: it runs once per call and returns the Task or IEnumerable, so a Return injection reads and replaces that value. It contains none of the body that was written, so Around, Transpiler, Constant and Argument have nothing to act on there.

StateMachine = 1

Patch the generated state machine's MoveNext, where the body that was written lives. It runs once per step rather than once per call, and it returns bool - not the declared return type - so a Return injection here sees a step flag.