Imports System
Imports System.Xml.Serialization
Imports System.IO
Public Class MainClass
Shared Sub Main()
Dim emp As New Employee("Joe", "Yin")
Dim string_writer As New StringWriter()
Dim serializer As New XmlSerializer(GetType(Employee))
serializer.Serialize(string_writer, emp)
Console.WriteLine(string_writer.ToString)
End Sub
End Class
<Serializable()> _
Public Class Employee
Public FirstName As String
Public LastName As String
Public Sub New()
End Sub
Public Sub New(ByVal first_name As String, ByVal last_name As String)
FirstName = first_name
LastName = last_name
End Sub
End Class
|