I have a class ActiveList<T>: ObservableCollection<T>
that I wish to store in a dictionary with key of Type
, which is the T
of ActiveList
, something like:
Dictionary<Type, ActiveList<T>>
Of course the dictionary cannot be typed, as it should cater for different types for T
. It may help if you know that T
is constrained to XTimeEntity
, so I could consider making the dictionary:
Dictionary<Type, ActiveList<XTimeEntity>>
but how would I cast an ActiveList<XtimeEntity>
to an ActiveList<T>
when I want Dictionary[T]
?
Is there an Interface all ActiveLists share? Than you could have a Dictionary<Type, IActiveList>
. But you would still have to cast the received value.