I'm implementing a ConvertingCollection, which aims to provide a collection of converted items (B), given a live collection of original items (A). The Collection B would reflect any change occurring in Collection A. The target is to use it in MVVM as a collection of ViewModels given a collection of Models, but I believe that it could be used in many different contexts.
This class requires the user to provide a way to convert objects from a type A to a type B. I can find several ways to proceed, but I don't know enough about their differences to decide what is the best approach :
The best approach according to me:
Converterby implementing a class that offers both possibilities.
ConvertingCollectionwould expect a delegate as parameter, which is what a
ConvertingCollection, which may be problematic sometimes
ConvertingCollectionmore complex (check if an implicit conversion exists between the 2 types A and B), and I'm too lazy for this. Ok, that may be the first reason, but the other two are still valid. :)
I hope this helps.