Imports System
Imports System.Xml.Linq
Public Class MainClass
Public Shared Sub Main()
Dim employees As XElement = XElement.Load("Employees.xml")
Dim maxId As Integer = Aggregate ele In employees.<Employee> Into Max(CInt(ele.@id))
Dim newEmployee = <Employee id=<%= maxId + 1 %>>
<Name>First</Name>
<Title>Coder</Title>
<HireDate>07/15/2006</HireDate>
<HourlyRate>9.95</HourlyRate>
</Employee>
employees.Add(newEmployee)
End Sub
End Class
|