Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

ReplaceAll with an array of XAttribute 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 attArray As XAttribute() = { _             New XAttribute("NewAtt1", 1), _             New XAttribute("NewAtt2", 2), _             New XAttribute("NewAtt3", 3) _         }         root.ReplaceAll(attArray)         Console.WriteLine(root)     End Sub End Class