C#C
C#2y ago
IsNotNull

More Elegant Way to Make a Generic Lookup Type

I want to store things for lookup by a generic type.
Case: I have a storage class that I want to expose a Get<T>(string key) method, and internally is uses specialized storage lookup instances for each type.

Is the only way to do that today to use a Dictionary<System.Type, AbstractThing> and then cast my AbstractThing to MoreSpecific<T>?
Was this page helpful?