mardi 14 janvier 2020

C# data design for variable type dictionary value

I have a design right now where I want a dictionary that gives me some values that could be of different types. My idea would be to have some interface that would represent a potential value type so then I could implement the interface. My problem is that if I make a generic interface then I can't have the dictionary return multiple types of the interface. If I make variable interface methods, then I can't implement them properly in the wrapper classes. Does anyone have a good solution to have a dictionary with variable value types?

Aucun commentaire:

Enregistrer un commentaire