i want to create a dictionary like:
Dictionary<string,<Dictionary<string, string>>>
Why can't I?
If we get a string input which completely resembles a dictionary object (if the string looks like dictionary as in python) then we can easily convert it to dictionary using eval () in Python. string = " {'A':13, 'B':14, 'C':15}"
please note that I come from a JavaScript background where you can do whatever you want with a dictionary. Yes you can do that in JavaScript but you need to learn and understand that C# is a strongly typed language. That does not mean you have to be strong to type it, but it means the types are known at compile time (mostly).
You can use dynamic. However, in the end, form post will convert everything into string, so you might wanna convert int and object into string first. Then, you can just use Dictionary.
The most important feature of the python dictionaries is that they don’t allow polymorphism. Also, the keys in the dictionary are case-sensitive. Therefore, the uppercase and lowercase keys are considered different from each other. Later, you can access the dictionary data by referring to its corresponding key name.
One too many sets of <>
.
What you want is this:
Dictionary<string, Dictionary<string, string>>
Dictionary<string,Dictionary<string, string>>
2nd parameter is not a generic
so to speak
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