for (int index = 0; index < d.Count; index++)
{
var item = d.ElementAt(index);
var itemKey = item.Key;
var itemValue = item.Value;
}
for(int i=0;i
Dictionary
比如说保存一个Student的Name属性:
Student zhang = new Student("Jay",Genders.Female , 20);
//添加元素
student.Add(zhang.Name,zhang);
//通过关键字Key访问
Student stu = student["Jay"];
//元素遍历
foreach(Student student in students.Value)
{
Console.WritLine(student.Name);
}
试试看,是不是你要的答案