Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

Adding XElement to XElement

Imports System Imports System.Reflection Imports System.Xml Module Module1     Sub Main()         Dim xml As XElement = XElement.Load("People.xml")         xml.AddFirst(New XElement("person", _                         New XElement("id", 5), _                         New XElement("firstname", "Tom"), _                         New XElement("lastname", "Cruise"), _                         New XElement("idrole", 1)))         Console.WriteLine(xml)     End Sub End Module