Peter,
It's funny. As often as I work with this stuff, sometimes I still get a
hook. But, it was really quite simple.
Dim serializer As New
System.xml.Serialization.XmlSerializer(GetType(Arr ayList))
' A FileStream is needed to read the XML document.
Dim fs As New System.IO.FileStream("C:\array.xml",
System.IO.FileMode.Open)
Dim reader As New System.Xml.XmlTextReader(fs)
Dim list As ArrayList = CType(serializer.Deserialize(reader),
ArrayList)
Dim counter As Integer = 0
For counter = 0 To list.Count - 1
MessageBox.Show(list(counter))
Next
Please let me know if you need anything else.
"Peter" wrote:
Here's a simple example (VB.NET):
Option Strict
What would the code look like to deserialize this example?
Imports System
Imports System.Collections
Imports System.IO
Imports System.Xml.Serialization
Public Class App1
Shared Sub Main()
Dim list As ArrayList = New ArrayList()
Dim out As StreamWriter = New StreamWriter("array.xml")
Dim ser As XmlSerializer = New XMLSerializer(list.GetType())
list.Add("a")
list.Add("2")
list.Add("three")
ser.Serialize(out, list)
End Sub
End Class