Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO
Public Class MainClass
Public Shared Sub Main()
Dim serialize As XmlSerializer = New XmlSerializer(GetType(Product))
Dim MyMovieOrder As Product = New Product("PC", 101, 10)
serialize.Serialize(Console.Out, MyMovieOrder)
End Sub
End Class
Public Class Product
<XmlElementAttribute("Name")> Public name As String
<XmlAttributeAttribute("ID")> Public filmId As Integer
<XmlAttributeAttribute("count")> Public quantity As Integer
Public Sub New()
End Sub
Public Sub New(ByVal name As String, _
ByVal filmId As Integer, _
ByVal quantity As Integer)
Me.name = name
Me.filmId = filmId
Me.quantity = quantity
End Sub
End Class
|