' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Imports System
Imports System.IO
Imports System.Xml.Serialization

Public Structure Test
   Public a As Integer
   Public b As Double
   Public c As String
End Structure 

Class MainClass
   Public Shared Sub Main(ByVal args As String())
      Dim tst As Test
      tst.a = 123
      tst.b = 123.456
      tst.c = "ABC"
      Dim ser As XmlSerializer = New XmlSerializer(GetType(Test))
      Dim sw As StreamWriter = New StreamWriter("C:\test.xml")
      ser.Serialize(sw, tst)
      sw.Close
      Dim sr As StreamReader = New StreamReader("C:\test.xml")
      Dim tst2 As Test = CType(ser.Deserialize(sr), Test)
      sr.Close
      Console.WriteLine(tst2.a & " " & tst2.b & " " & tst2.c)
   End Sub
End Class 
