My basic requirements are:
- I need to be able to add objects to a collection, sorted by an object property of my choosing, knowing that the value of this property may occur more than once.
- I need to be able to later remove objects from this collection, preferably using the IComparer implementation built into the sorted object.
(I think I'd actually settle for the ability to just add and remove the sorted duplicate values without storing their associated objects, if this makes things any easier.)
Note #1: I've been using the IComparer implementation for duplicate keys as recommended here: C# Sortable collection which allows duplicate keys
However, I run into a problem when I want to remove an object. Since I'm using a custom IComparer object, the dictionary or list fails to find the object by its intrinsic IComparer implementation.
Note #2: I've also tried using the PowerCollections OrderedMultiDictionary class. This didn't bring me much closer to a solution, as I still have to choose between the ability to have duplicate keys (via a custom IComparer implementation) and being able to remove objects from the collection afterwards.