Imports System
Imports System.Xml.Linq
Public Class Employee
Public EmployeeID As Integer
Public FirstName As String
Public LastName As String
Public Title As String
Public HireDate As DateTime
Public HourlyWage As Double
End Class
Public Class MainClass
Public Shared Sub Main()
Dim employeeList = New Employee() _
{New Employee With {.EmployeeID = 1, _
.FirstName = "A", _
.LastName = "M", _
.Title = "Tester", _
.HireDate = DateTime.Now, _
.HourlyWage = 10.0}, _
New Employee With {.EmployeeID = 2, _
.FirstName = "B", _
.LastName = "C", _
.Title = "Tester", _
.HireDate = DateTime.Now, _
.HourlyWage = 10.75}}
Dim employees = <Employees>
<%= From emp In employeeList _
Select _
<Employee id=<%= emp.EmployeeID %>>
<Name><%= emp.FirstName & " " & emp.LastName %></Name>
<Title><%= emp.Title %></Title>
<HireDate><%= emp.HireDate.ToString("MM/dd/yyyy") %></HireDate>
<HourlyRate><%= emp.HourlyWage %></HourlyRate>
</Employee> _
%>
</Employees>
employees.Save("Employees.xml")
Console.WriteLine(employees.ToString())
End Sub
End Class
|