Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

Loop through all of the Employee elements and remove the HireDate element

Imports System Imports System.Xml.Linq     Public Class MainClass         Public Shared Sub Main()             Dim employees As XElement = XElement.Load("Employees.xml")             employees.<Employee>.ElementAt(3).Remove()             For Each ele In employees.<Employee>.ToList                 ele.SetElementValue("HireDate", Nothing)             Next             Console.WriteLine(employees.ToString)         End Sub     End Class