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

解决方案 »

  1.   

    foreach(var item in 你那字典)
    {
        item.Key 就是枚举类型
        item.Value 就是枚举类型对应的软件详细信息列表
    }
      

  2.   


                foreach (KeyValuePair<DeviceModel, List<SoftwareInfo>> kvPair in dic)
                {
                    // 得到字典的Key,即DeviceModel枚举
                    kvPair.Key                //便利Key对应的Value,即 List<SoftwareInfo>
                    foreach (List<SoftwareInfo> list in kvPair.Value)
                    {
                        
                    }
                }