Nested XML to Dictionary

前端 未结 4 1125
既然无缘
既然无缘 2021-01-25 03:44

I am trying to convert an XML data into dictionary. I am having problems with identical node names. C# .Net 3.5

Sample XML = the problem is I have no control over this.

4条回答
  •  旧时难觅i
    2021-01-25 04:26

    Unless you provide a unique, non-nullable key, you won't be able to import to a dictionary structure. A couple of options I can think of:

    • Create an artificial key during import
    • Utilize the ToLookup() extension method instead. This doesn't return a dictionary but may suite your needs. Given a better idea of why you need a dictionary, I could possible help more.

提交回复
热议问题