Dictionary object in .Net
-
What could be the possible situations/scenarios when you want to have a dictionary object within dictionary? Meaning a dictionary object which would take another dictionary as its key. private Dictionary<Dictionary<string, string>, string> myDictionary = new Dictionary<Dictionary<string, string>, string> ; I mean, I'm trying to go through some code and its doing that, I am new to such complicated data structures such as ditionaries....and this doesnt even look like a common way most people use it. Post people would have a string key and a string value ( or interger or something). can someone elaborate on this? Thanks a lot Tina
-
What could be the possible situations/scenarios when you want to have a dictionary object within dictionary? Meaning a dictionary object which would take another dictionary as its key. private Dictionary<Dictionary<string, string>, string> myDictionary = new Dictionary<Dictionary<string, string>, string> ; I mean, I'm trying to go through some code and its doing that, I am new to such complicated data structures such as ditionaries....and this doesnt even look like a common way most people use it. Post people would have a string key and a string value ( or interger or something). can someone elaborate on this? Thanks a lot Tina
-
I'm not sure what you meant...this is all done from a ASP .net page and that's why the questions was published in this section. Please educate me if there's a separate location pertaiing to questions regarding such data structures and their use. Now my question is that I'm not familiar with Dictionary data structure, so I'm not sure how is stuff functioning in the code that I'm looking at right now written by someone else with no cmments or documentation... I googled it quite a bit, but no one appear to be using Dictionary in a way that either its key or the value element are another DIctionary object. Can anyone please share their experience if they've used it or are familiar with it. Thanks Tina
-
I'm not sure what you meant...this is all done from a ASP .net page and that's why the questions was published in this section. Please educate me if there's a separate location pertaiing to questions regarding such data structures and their use. Now my question is that I'm not familiar with Dictionary data structure, so I'm not sure how is stuff functioning in the code that I'm looking at right now written by someone else with no cmments or documentation... I googled it quite a bit, but no one appear to be using Dictionary in a way that either its key or the value element are another DIctionary object. Can anyone please share their experience if they've used it or are familiar with it. Thanks Tina
Tina P wrote:
this is all done from a ASP .net page and that's why the questions was published in this section
But it's not related to ASP.NET, it's just vanilla C#, it could be in any C# project.
Tina P wrote:
Please educate me if there's a separate location pertaiing to questions regarding such data structures and their use
C# forum for general C# questions
Tina P wrote:
Now my question is that I'm not familiar with Dictionary data structure, so I'm not sure how is stuff functioning in the code that I'm looking at right now written by someone else with no cmments or documentation...
OK, well, that's another question. You have a dictionary, and when you look up a key, the value you get back is another dictionary. So, you could use this, for example, to create a grid, look up x first, then y. Of course, you'd usually use a 2D array for that, but the point is, to get to the data you want, you obvously need to look up two values, not one. It's just a dictionary, twice. You provide two keys to get to the end value.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.