Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

ReplaceAll with an array of XElement objects

Imports System Imports System.Xml Imports System.Xml.XPath Public Class MainClass     Public Shared Sub Main()         Dim root As XElement = _              <Root>                 <Child>child content</Child>             </Root>                  Dim ellArray As XElement() = { _             New XElement("NewChild1", 1), _             New XElement("NewChild2", 2), _             New XElement("NewChild3", 3) _         }         root.ReplaceAll(ellArray)         Console.WriteLine(root)     End Sub End Class