Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I create a dictionary<string, dictionary<string,string>>?

Tags:

c#

dictionary

i want to create a dictionary like:

Dictionary<string,<Dictionary<string, string>>>

Why can't I?

like image 421
Blankman Avatar asked Aug 16 '10 21:08

Blankman


People also ask

How to convert string to dictionary in Python?

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}"

Is it possible to create a dictionary in JavaScript?

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).

Is it possible to use a dynamic dictionary in form post?

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.

What are the features of Python 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.


2 Answers

One too many sets of <>.

What you want is this:

Dictionary<string, Dictionary<string, string>>
like image 166
Adam Sills Avatar answered Nov 15 '22 07:11

Adam Sills


Dictionary<string,Dictionary<string, string>>

2nd parameter is not a generic so to speak

like image 25
PostMan Avatar answered Nov 15 '22 06:11

PostMan