/// <summary> /// Advances the enumerator to the next element of the collection. /// </summary> /// <returns>True if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns> public Boolean MoveNext() { switch (_InternalState) { case SingleEnumeratorState.BEFORE: _InternalState = SingleEnumeratorState.AT; return(true); case SingleEnumeratorState.AT: _InternalState = SingleEnumeratorState.BEHIND; return(false); case SingleEnumeratorState.BEHIND: return(false); } return(false); }
/// <summary> /// Creates a new single element enumerator based on the given element. /// </summary> /// <param name="myElement">The element within the enumerator.</param> public SingleEnumerator(T myElement) { _Element = myElement; _InternalState = SingleEnumeratorState.BEFORE; }
/// <summary> /// Sets the enumerator to its initial position, which is /// before the first element in the collection. /// </summary> public void Reset() { _InternalState = SingleEnumeratorState.BEFORE; }