日期:2014-05-17  浏览次数:20415 次

求助 如何遍历dictionary<enum,class>输出?
我调用接口返回 Dictionary<DeviceModel, List<SoftwareInfo>> 
其中DeviceModel为enum枚举类型,SoftwareInfo为每一种设备类型对应的软件详细信息,就是一个class 请问 我该如何遍历每种DeviceModel 然后把相对应的信息输出?

------解决方案--------------------
C# code
foreach(KeyValuePair<DeviceModel, List<SoftwareInfo>> item in dic)
{
//item.Key对应DeviceModel
//item.Value对应List<SoftwareInfo>
}
//Linq
dic.ToList().ForEach(x=>{
//x.Key对应DeviceModel
//x.Value对应List<SoftwareInfo>
})