this is the xml
<Basic>
<Results>
<Result>a1</Result>
<Result>a2</Result>
<Result>a3</Result>
</Results>
</Basic>
I need to read this xml file and create a list that will contain
list[0] = a1
list[1] = a2
list[2] = a3
what is the simple and fast way to do it ?
You can use LinqToXml
var list = XDocument.Load(filename)
.Descendants("Result")
.Select(x => (string)x)
.ToList();
使用 XML 阅读器和编解码器将 DOM 树转换为列表。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.