VB.Net by API/System.Xml.Serialization/XmlSerializer — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:51, 26 мая 2010
XmlSerializer.Serialize
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