PostSharpAPI ReferencePost­Sharp.​Aspects.​Internals.​State­MachineBase­Generated­Iterator­State­Machine<TElement>
Open sandboxFocus

BaseGeneratedIteratorStateMachine<TElement> Class

Base class for PostSharp-created state machines created for methods that return IEnumerable, if there's a semantically advised method boundary advice in front of a non-semantically advised advice.

Inheritance
BaseGeneratedIteratorStateMachine<TElement>
Implements
IEnumerator<TElement>
System.Collections.IEnumerator
IDisposable
System.Collections.Generic.IEnumerable<TElement>
System.Collections.IEnumerable
Namespace: PostSharp.Aspects.Internals.StateMachine
Assembly: PostSharp.dll
Syntax
[Internal]
public abstract class BaseGeneratedIteratorStateMachine<TElement> : Object
Type Parameters
Name Description
TElement

Type of elements of the enumerator or enumerable. If it's a non-generic enumerator or enumerable, then this is Object.

Remarks

In this class, "the target method" means a newly created method to which we moved the body of the "kickoff" method (the method to which the user applied the aspects).

This class always uses the non-generic enumerable and the non-generic enumerator because it works for non-generic enumerables and pretty much all generic enumerables have the same methods implementing both the generic and the non-generic interfaces.

Constructors

Name Description
BaseGeneratedIteratorStateMachine()

Fields

Name Description
isDisposing
state
yieldValue

Properties

Name Description
Current

Methods

Name Description
CallTargetEnumerableMethod()

Calls the target method, possibly with some arguments changed. This method is only overridden if the target method has System.Collections.IEnumerable or System.Collections.Generic.IEnumerable<> as the return type.

CallTargetEnumeratorMethod()

Calls the target method, possibly with some arguments changed. This method is only overridden if the target method has System.Collections.IEnumerator or IEnumerator<T> as the return type.

CreateCopy()

Creates an enumerator from this enumerable as a copy of this instance. See Remarks.

Dispose()

Disposes the decorated enumerator and calls OnSuccess and OnExit, if OnEntry was called but OnExit wasn't yet called.

MoveNext()

Advances this (as an enumerator) to the next element by calling MoveNext() on the decorated enumerator, then accesses its Current and stores it, so that it can be read and modified by OnYield(MethodExecutionArgs) advices.

Reset()