/// <summary> /// Advance the enumerator to the next GoObject. /// </summary> /// <returns>True if there is a next GoObject; false if it has finished iterating over the collection.</returns> public bool MoveNext() { if (myOriginalCollection != null && myOriginalCollection.myChanges != myOriginalChanges) { throw new InvalidOperationException(myOriginalCollection.GetType().FullName + " was modified during enumeration."); } checked { if (myForward) { if (myIndex + 1 < myArray.Count) { myIndex++; return(true); } return(false); } if (myIndex - 1 >= 0) { myIndex--; return(true); } return(false); } }