none
Dictionary<string, Dictionary<string, string>> ???? RRS feed

  • Question

  • Hi. I'm new to c# and I'm learning Dictionary. And I have a problem.

    I have a program that students sign up and their information store in a Dictionary<string, string>. Then I have another Dictionary<string, dictionary<string, string>> that the key is every student's code and the value is the first Dictionary<string, string>.

    I have made the first Dictionary<string, string> but I'm totally confused with the second. Can anybody help me please?

    This is my code, but I think something is missing at the end of it.

     

    public partial class RegisterPage : Form  

    { Dictionary<String, String> dic1 = new Dictionary<string, string>(); Dictionary<String, Dictionary<String, String>> dic2 = new Dictionary<string, Dictionary<String, String>>(); int studentsNum = 0; public void btn_Save_Click(object sender, EventArgs e)        { studentsNum++;            dic1.Add("S " + studentsNum.ToString() + " Name", txb_Name.Text);            dic1.Add("S " + studentsNum.ToString() + " LastName", txb_LastName.Text);            dic1.Add("S " + studentsNum.ToString() + " Father's Name", txb_FatherName.Text);            dic1.Add("S " + studentsNum.ToString() + " Lesson 1 Score", txb_Lesson1.Text);            dic1.Add("S " + studentsNum.ToString() + " Lesson 2 Score", txb_Lesson2.Text);            dic1.Add("S " + studentsNum.ToString() + " Lesson 3 Score", txb_Lesson3.Text);            dic1.Add("S " + studentsNum.ToString() + " Lesson 4 Score", txb_Lesson4.Text);            dic1.Add("S " + studentsNum.ToString() + " Lesson 5 Score", txb_Lesson5.Text);            dic1.Add("S " + studentsNum.ToString() + " Lesson 6 Score", txb_Lesson6.Text); }



    Tuesday, October 13, 2015 8:46 AM

Answers

All replies