utilities icon indicating copy to clipboard operation
utilities copied to clipboard

Allow backwards enumeration of DeletableObjectList

Open paulcscharf opened this issue 8 years ago • 3 comments

I have found the collection very useful in all sorts of places, most recently in a custom event-subscription system. For that I may want to enumerate the list in reverse, which can be done almost trivially by adding another Enumerator.

While the current enumerator also enumerates items that are added during enumeration, this new one would not, but that seems a minor issue, or maybe even desired behaviour.

I propose adding the following property:

IEnumerable<T> DeletableObjectList<T>.Reversed { get; }

The list could keep a no-data object internally which is returned with this property and implements GetEnumerator() correctly. While a bit of a shame in terms of memory, this will make sure there is no unnecessary pressure on the GC.

paulcscharf avatar May 24 '16 07:05 paulcscharf