Serialize and Deserialize Xml to Disk Using Generics

If you need to serialize and deserialize your objects and persist them to disk, the the code below is an easy way to accomplish this. The GetObjectTypes function correctly detects types so that the serializer will do it's job correctly. Without this you could run into problems (as I did).VB     ''' <summary>     ''' [...]

How to Serialize and Deserialize Your Objects

I came up with some generic methods to do the job:Public Shared Function DeserializeXMLToObject(ByVal input As String, ByVal type As System.Type) As Object  Dim result As Object = Nothing  Dim serializer As New XmlSerializer(type)  Try    result = serializer.Deserialize(New XmlTextReader(New StringReader(input)))  Catch ex As Exception    Debug.WriteLine(ex.Message)  End Try   Return resultEnd FunctionPublic Shared Function SerializeObjectToXML(ByVal input As [...]

How to Serialize/Deserialize Your Objects

I came up with some generic methods to do the job:Public Shared Function DeserializeXMLToObject(ByVal input As String, ByVal type As System.Type) As Object  Dim result As Object = Nothing  Dim serializer As New XmlSerializer(type)  Try    result = serializer.Deserialize(New XmlTextReader(New StringReader(input)))  Catch ex As Exception    Debug.WriteLine(ex.Message)  End Try   Return resultEnd FunctionPublic Shared Function SerializeObjectToXML(ByVal input As [...]