Using LINQ to parse XML into Dictionary

前端 未结 3 1191
挽巷
挽巷 2021-01-06 03:35

I have a configuration file such as:


    
            


        
3条回答
  •  梦谈多话
    2021-01-06 04:22

    Your call to ToDictionary needs a key and value selector. Starting with that you have, it can be

    var dictionary = yourQuery.ToDictionary(item => item.Name, item => item.Value);
    

提交回复
热议问题