I have this class:
<Serializable()> _
Public Class Bonder
''' <summary>
''' General information
''' </summary>
''' <remarks></remarks>
Public BonderName As String
Public Serial_Number As String
Public System_Type As String
Public DM_Version As String
Public RTS_Build As String
Public RTS_Label As String
Public CPU_Boot_Rom As String
Public BondHead_1 As String = ""
Public BondHead_2 As String = ""
Public IP1 As String
Public IP2 As String
Public LoadedLeadFrameSetup As String
Public LoadedMagazineHandler As String
Public LoadedProcessProgram As String
''' <summary>
''' Configuration Information
''' </summary>
''' <remarks></remarks>
Public ConfigurationKVP As New ArrayList
''' <summary>
''' Devices on the Bonder
''' </summary>
''' <remarks></remarks>
Public DevicesOnBonder As New ArrayList
''' <summary>
''' RTS server information
''' </summary>
''' <remarks></remarks>
Public ServerInfo As New ArrayList
''' <summary>
''' RTS Options selected
''' </summary>
''' <remarks></remarks>
Public Options As New ArrayList
End Class`
This is my code to serialize it and put it into XML format:
Dim serializer As XmlSerializer
serializer = New XmlSerializer(currentBonderSetup.GetType)
Dim tw As New StreamWriter("c:\book1.xml")
serializer.Serialize(tw, currentBonderSetup)
tw.Close()
Where am I going wrong? I think the issue is from the ArrayLists but I dont know how to solve it. the ArrayLists contain other objects that to have the Serializeable attribute.
Here are the other classes
<Serializable()> _
Public Class Configs
Public Item As String
Public Value As String
Public Sub New(ByVal key As String, ByVal result As String)
Item = key
Value = result
End Sub
End Class
<Serializable()> _
Public Class BonderDevices
Public Device_Type As String
Public Instance As String
Public Board_Rev As String
Public Software_Ver As String
Public Status As String
Public Data As String
End Class
<Serializable()> _
Public Class ServerInfo
Public Type As String
Public Value As String
End Class
try constructing your serializer so…
and, yeah, you need default parameterless constructors on all your types.
in VB