Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

Loop through all the HourlyRate elements, setting them to the new payrate, which is the old rate 5%

Imports System Imports System.Xml.Linq     Public Class MainClass         Public Shared Sub Main()             Dim employees As XElement = XElement.Load("Employees.xml")             Dim beforeQuery = From ele In employees.<Employee> Select Name = ele.<Name>.Value, Wage = CDbl(ele.<HourlyRate>.Value)             Dim currentPayRate As Double = 0             For Each ele In employees.<Employee>.<HourlyRate>                 currentPayRate = (ele.Value) + ((ele.Value) * 0.05)                 ele.SetValue(currentPayRate)             Next         End Sub     End Class