Public Class Form1
Structure hgf
Dim yy As String
<Xml.Serialization.XmlElement()> Dim ff() As ee
Dim kk As String
Structure ee
Dim hg As String
Dim hh As String
End Structure
End Structure
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim g As New hgf
g.yy = "uyt"
g.kk = "mmm"
ReDim g.ff(3)
g.ff(0).hg = "123"
g.ff(1).hg = "123"
g.ff(0).hh = "123"
g.ff(2).hh = "ggfd"
Dim writer As New System.IO.StreamWriter("c:/123.xml")
Dim xs As New System.Xml.Serialization.XmlSerializer(g.GetType)
xs.Serialize(writer, g)
writer.Close()
MsgBox("ok")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim g As New hgf
Dim reader As New System.IO.StreamReader("c:/123.xml")
Dim xs As New System.Xml.Serialization.XmlSerializer(g.GetType)
Dim obj As hgf = xs.Deserialize(reader)
reader.Close()
End Sub
End Class