/// <summary> /// Returns an Enumerator of type <TKey, TValue>, Requirements reqest lack of a yeild operator in code /// </summary> /// <returns></returns> public IEnumerator <KeyValuePair <TKey, TValue> > GetEnumerator() { var returnList = InnerArray .Where(filter => (filter != null && filter.IsDeleted == false)) .Select(output => new KeyValuePair <TKey, TValue>( CloneObject(output.Key), CloneObject(output.Value) )).ToList <KeyValuePair <TKey, TValue> >(); var enumerator = new ODDictionaryEnumerator <TKey, TValue>(returnList, this); EnumeratorsToInvalidate.Add(enumerator); return(enumerator); }
/// <summary> /// When an enumerator is disposed of, the dictionary gets a callback and it is removed from the list of enumerators to invalidate /// </summary> /// <param name="enumerator"></param> public void DisposeOf(ODDictionaryEnumerator <TKey, TValue> enumerator) { EnumeratorsToInvalidate.Remove(enumerator); }