Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine XmlNodelist

Tags:

c#

xmlnodelist

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

like image 833
Anjana Avatar asked Sep 28 '10 15:09

Anjana


1 Answers

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>());
like image 148
Tim Armstrong Avatar answered Oct 10 '22 18:10

Tim Armstrong