PostSharp6.6//API Reference/Post­Sharp.​Aspects.​Internals.​State­Machine Namespace/Base­Generated­Iterator­State­Machine(TElement) Class

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 Hierarchy

Namespace:  PostSharp.Aspects.Internals.StateMachine
Assembly:  PostSharp (in PostSharp.dll) Version: (
public abstract class BaseGeneratedIteratorStateMachine<TElement> : IEnumerator<TElement>, 
	IDisposable, IEnumerator, IEnumerable<TElement>, IEnumerable

Type Parameters

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

The BaseGeneratedIteratorStateMachine<TElement> type exposes the following members.

Protected methodBaseGeneratedIteratorStateMachine<TElement>
Initializes a new instance of the BaseGeneratedIteratorStateMachine<TElement> class
Public methodCallTargetEnumerableMethod
Calls the target method, possibly with some arguments changed. This method is only overridden if the target method has IEnumerable or IEnumerable<T> as the return type.
Public methodCallTargetEnumeratorMethod
Calls the target method, possibly with some arguments changed. This method is only overridden if the target method has IEnumerator or IEnumerator<T> as the return type.
Public methodCreateCopy
Creates an enumerator from this enumerable as a copy of this instance. See Remarks.
Public methodDispose
Disposes the decorated enumerator and calls OnSuccess and OnExit, if OnEntry was called but OnExit wasn't yet called.
Public methodMoveNext
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.
Extension Methods
Public Extension MethodToAdvisableCollection<TElement>
Converts an IEnumerable<T> into an AdvisableCollection<T>.
(Defined by Extensions.)
Public Extension MethodToAdvisableDictionary<TElement, TKey, TValue>
Converts an IEnumerable<T> into a AdvisableDictionary<TKey, TValue> given a method returning the item key and a method returning the item value.
(Defined by Extensions.)
Public Extension MethodToAdvisableHashSet<TElement>
Converts an IEnumerable<T> into an AdvisableHashSet<T>.
(Defined by Extensions.)
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.

See Also