What’s the .NET datatype that allows the retrieval of data by a unique key?

What’s the .NET datatype that allows the retrieval of data by a unique key?
LVL 1
chuang4630Asked:
Who is Participating?
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
0
 
Fernando SotoRetiredCommented:
Hi chuang4630,

Yes it can. Set a breakpoint then when the program breaks right click on the variable you want to change and select Add Watch. Now go to the Watch window and double click on the value you want to change and set it the new value and hit return.
I hope that this was of some help.

Fernando
0
 
Fernando SotoRetiredCommented:
FernandoSoto,

Sorry posted to the wrong question.

Fernando
0
 
pallospCommented:
In .NET 2.0 it's the generic Dictionary collection.

Here is an example:

Dictionary<string, int> x = new Dictionary<string, int>();
x["a"] = 1;
x["b"] = 2;
if (x.ContainsKey("a"))
    Console.WriteLine(x["a"]);
foreach (KeyValuePair<string, int> item in x) {
    Console.WriteLine(String.Format("{0} -> {1}", item.Key, item.Value));
}

You may use a compound type instead of int.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.