/// <summary> /// Get an enumerator that will loop thru the collection of values. /// </summary> /// <returns>An enumerator for the collection.</returns> public IEnumerator <TValue> GetEnumerator() { for (Leaf <TKey, TValue> currentLeaf = tree.GetFirstLeaf();;) { for (int leafIndex = 0; leafIndex < currentLeaf.KeyCount; ++leafIndex) { yield return(currentLeaf.GetValue(leafIndex)); } currentLeaf = currentLeaf.RightLeaf; if (currentLeaf == null) { break; } } }
public void Reset() { leafIndex = -1; currentLeaf = target.GetFirstLeaf(); }