Answered by:
Dictionary<string, Dictionary<string, string>> ????

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
-
I suggest posting your question at the C# forum:
https://social.msdn.microsoft.com/Forums/vstudio/en-us/home?forum=csharpgeneral
The Training and Certification forum in which you originally asked it would be the adequate place if you were asking about a training course for learning C#, but it is not the right place to get your C# questions answered.
- Marked as answer by Danny van DamMVP, Editor Monday, November 30, 2015 11:45 AM
Thursday, October 15, 2015 10:40 AM -
Hi samin,
Its called Double Key Dictionary or Multi-key dictionary. Please read the below article for more information. Hope this helps you.
Thanks,
Sabah Shariq
- Proposed as answer by Sabah ShariqMVP Monday, October 19, 2015 9:02 AM
- Marked as answer by Danny van DamMVP, Editor Monday, November 30, 2015 11:45 AM
Thursday, October 15, 2015 6:57 PM
All replies
-
I suggest posting your question at the C# forum:
https://social.msdn.microsoft.com/Forums/vstudio/en-us/home?forum=csharpgeneral
The Training and Certification forum in which you originally asked it would be the adequate place if you were asking about a training course for learning C#, but it is not the right place to get your C# questions answered.
- Marked as answer by Danny van DamMVP, Editor Monday, November 30, 2015 11:45 AM
Thursday, October 15, 2015 10:40 AM -
Hi samin,
Its called Double Key Dictionary or Multi-key dictionary. Please read the below article for more information. Hope this helps you.
Thanks,
Sabah Shariq
- Proposed as answer by Sabah ShariqMVP Monday, October 19, 2015 9:02 AM
- Marked as answer by Danny van DamMVP, Editor Monday, November 30, 2015 11:45 AM
Thursday, October 15, 2015 6:57 PM -
I didn't know. thanksSaturday, October 17, 2015 3:41 PM