I’ve been working on a project lately that has involved quite a few list classes and I found myself wondering, in what situation is it (if ever) appropriate to create custom collection/dictionary implementations these days? With the introduction of generics, doesn’t List and Dictionary (or queue, stack, etc.) do everything someone would need 99% of the time and if not, wouldn’t you just want to inherit from one of these existing classes? What would be the benefits of rolling your own implementation at this point?
Share
I did this when trying to write a library that targeted multiple frameworks including 1.1 – so generics aren’t an option, and ArrayList etc aren’t options because they don’t exist on Silverlight. Hence I needed a custom collection.
Other scenarios relate to limited / different mutate operations, I.e. not the usual Add/Remove etc.