I am writing a recursive discovery method, which will basically deserialize an object. This object is always a List of Dictionaries, but sometimes the dictionary will have other Dictionaries as values and sometimes the dictionary will have strings as values.
I need to declare the List at the beginning somehow. List<Dictionary<string,???>>
I am in a pickle at the moment, anybody know a solution?
Basically the closest you can come is probably List<IDictionary>
(the non-generic IDictionary
interface).
Given that the dictionaries can have different key and value types, you wouldn't be able to use them in a type-safe way at compile-time anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With