C#

Different type of generic classes in a list

I recently came across a functionality where I need to have a generic class with a generic property. As an example I needed different field classes where each field has it’s value. I have two different classes for a string and an integer. Now I need a list, where I want to store this different fields, something like this: But unfortunately the compiler is not happy with this. Why should he? It’s totally unclear what the type is. So I thought about how to specify this type. But I don’t know…

Keep reading »