public class SimpleYieldBreakEquivalentEnumerator : IEnumerator<YieldInstruction>
This is an implementation of an IEnumerator equivalent to a method that returns IEnumerator<YieldInstruction> with a single yield break statement in the method body. Rather than using that construct, you can initilize an instance of this class once and then simply return it in the method body, rather than using yield break (which will create a compiler generated class behind the scene, which will be instantiated each time the method is called, generating garbage). Alternatively, because the class has no state and the MoveNext simply returns false, I have provided a static Instance property which can be used to ensure only one instance of this class is ever created.
Name | Type | Description |
---|---|---|
Current | YieldInstruction |
Not implemented, as MoveNext will always return false and thus it should not be called. |
Instance | SimpleYieldBreakEquivalentEnumerator |
Gets an instance which of the SimpleYieldBreakEquivalentEnumerator which you can use freely across threads, scenes, whatever, at the same time as any other caller using it. |
Not implemented
Not implemented
public bool MoveNext()
Simply returns false every time it is called.
type
false alaways