PostSharp 6.6 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Aspects.​Internals.​State­Machine Namespace / Base­Generated­Iterator­State­Machine(TElement) Class / Base­Generated­Iterator­State­Machine(TElement) Methods / Base­Generated­Iterator­State­Machine(TElement).​Create­Copy Method

BaseGeneratedIteratorStateMachine<TElement>.CreateCopy Method

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

Namespace:  PostSharp.Aspects.Internals.StateMachine
Assembly:  PostSharp (in PostSharp.dll) Version: (
public abstract BaseGeneratedIteratorStateMachine<TElement> CreateCopy()

Return Value

Type: BaseGeneratedIteratorStateMachine<TElement>
A copy of this instance.
This method is only called if this instance represents an enumerable. It's called only from GetEnumerator() and GetEnumerator() and its return value represents the enumerator.

This way, each enumerator has its own set of arguments and its own method execution tag, so and if you change the arguments or the tag, it will only affect that enumerator an not all of them.

See Also