System.Runtime.CompilerServices.StateMachineAttribute Class

Allows you to determine whether a method is a state machine method.

See Also: StateMachineAttribute Members

Syntax

[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
public class StateMachineAttribute : Attribute

Remarks

You should not apply the StateMachine attribute to methods in your code. For methods that are state machine methods, the compiler will apply the System.Runtime.CompilerServices.AsyncStateMachineAttribute or System.Runtime.CompilerServices.IteratorStateMachineAttribute in the emitted IL.

When checking whether a method is a state machine method, it is preferable to instead check for following attributes, which are derived from StateMachineAttribute:

Note:

StateMachineAttribute cannot be used to check whether a method is a state machine method if the method is an iterator method in C#.

Requirements

Namespace: System.Runtime.CompilerServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0