How to access specific keys/values in a dictionary C#
c#, dictionary
Solution
You may want to use an `OrderedDictionary`.
http://msdn.microsoft.com/en-us/library/system.collections.specialized.ordereddictionary.aspx
You will be then able to use an index.
Problem
I am building a flash card application to help me study in High School. The user enters terms and definitions in a dictionary. Now I can't figure out how to set the labels to randomly show a term and its definition. My methods code goes something like this: ``` public void startQuiz() { Random random = new Random(); int randNum; //My dictionary with all the terms and //definitions is called terms randomNum = random.Next(terms.Count); termLabel.Text = // ??? definitionLabel.text = //??? } ``` I hope that is coherent enough. I basically want the randomNum to index a specific key and value from my dictionary of "terms." Then set the termLabel text to the chosen key value (which is a string), and the definitionLabel text to the specified value (also a string). I will be happy to provide clarification, as I am barely learning how to use visual c# Here is my dictionary ``` Dictionary<string, string> terms = new Dictionary<string, string>() //Here is how terms get added private void addTermButton_Click(object sender, EventArgs e) { term = termBox.Text; definition = definitionBox.Text; terms.Add(term, definition); //Clear text boxes for more terms and definitions termBox.Text = ""; definitionBox.Text = ""; } ```