Combine XmlNodelist

笑着哭i 提交于 2019-12-01 16:39:42

问题


Can any one please give me a solution to combine xmlNodelists to a single list .


回答1:


I would use LINQ's .Concat method. The problem is that XmlNodeList is IEnumerable as opposed to IEnumerable< XmlNode >. Thus you have to call .Cast< XmlNode > on your XmlNodeLists.

For example:

   var List = nodesoriginal.Cast<XmlNode>().Concat<XmlNode>(nodesupdate.Cast<XmlNode>());


来源:https://stackoverflow.com/questions/3814500/combine-xmlnodelist

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!