SpeakableEnumerator<TCurrent, TThis> Class
Definition
Section titled “Definition”A class that wraps an IEnumerator<T> object. Allows access to basic fields of the IEnumerator.
public sealed class SpeakableEnumerator<TCurrent, TThis> : ISpeakableEnumeratorType Parameters
Section titled “Type Parameters”TCurrent
The type of Current.
TThis
The declaring type.
Inheritance object
Implements ISpeakableEnumerator
Constructors
Section titled “Constructors”SpeakableEnumerator(IEnumerator<TCurrent>)
Section titled “SpeakableEnumerator(IEnumerator<TCurrent>)”A class that wraps an IEnumerator<T> object. Allows access to basic fields of the IEnumerator.
public SpeakableEnumerator(IEnumerator<TCurrent> instance)Parameters
Section titled “Parameters”instance IEnumerator<TCurrent>
An enumerator instance.
Properties
Section titled “Properties”Gets the instance of the class that constructed this enumerator.
This corresponds to the <>4__this field.
public TThis This { get; }Remarks
Section titled “Remarks”Use Enumerator for getting the instance of the enumerator this class wraps.
Enumerator
Section titled “Enumerator”Gets the instance of the IEnumerator wrapped by this class. Note that this is not the instance of the class that constructed this enumerator.
public IEnumerator<TCurrent> Enumerator { get; }Current
Section titled “Current”The Current value of this enumerator.
This corresponds to the <>2__current field.
public TCurrent Current { get; set; }The state value of this enumerator.
This corresponds to the <>1__state field.
public int State { get; set; }Methods
Section titled “Methods”PreBuildFieldReferenceGetters(Type)
Section titled “PreBuildFieldReferenceGetters(Type)”Can be used for building field reference getter methods ahead-of-time to prevent a freeze that would happen when building them just-in-time.
public static void PreBuildFieldReferenceGetters(Type type)Parameters
Section titled “Parameters”type Type
The type of Enumerator to build field reference getters for.
Exceptions
Section titled “Exceptions”Remarks
Section titled “Remarks”MonoDetour already uses this where it uses SpeakableEnumerator types.
GetOrCreate(IEnumerator<TCurrent>)
Section titled “GetOrCreate(IEnumerator<TCurrent>)”Gets or creates a SpeakableEnumerator<TCurrent, TThis> for the specified instance.
public static SpeakableEnumerator<TCurrent, TThis> GetOrCreate(IEnumerator<TCurrent> instance)Parameters
Section titled “Parameters”instance IEnumerator<TCurrent>
An enumerator instance.
Returns
Section titled “Returns”SpeakableEnumerator<TCurrent, TThis>
A new or existing SpeakableEnumerator<TCurrent, TThis>.