运行程序

将Dictionary转换为List
将Dictionary 转换成List调用ToList方法,之前已经创建了一个StudentDictionary对象。直接看如何这个对象转换到list.
List<Student> DictionaryToList = StudentDictionary.Values.ToList();
foreach (Student student in DictionaryToList)
{
Console.WriteLine("Id = "+student.Id+" "+" Name = "+student.Name+" "+" Gender = "+student.Gender);
}
运行程序

以上所述是小编给大家介绍的#数组中List, Dictionary的相互转换问题,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对ASPKU网站的支持!
注:相关教程知识阅读请移步到c#教程频道。










