I know this is possible, and it is probably something simple that I am missing...
I have a fairly complex class to handle deserialization of an XML file. I wish to place a [class].loadfile method within the class. It looks something like this:
Serialization decoration left out for simplicity...
The Deserialization is working just fine (that's my own code), but assigning the object value to Me is not correct. What I want is for an instantiation of this class to have a LoadFile method (similar to the XML class LoadFile method) - but I cannot figure out how to set the value of the class from within the class.
Any help would be greatly appreciated!
I have a fairly complex class to handle deserialization of an XML file. I wish to place a [class].loadfile method within the class. It looks something like this:
Serialization decoration left out for simplicity...
Code:
Public MyClass
Property datatype as new cls_datatype
Property data as new cls_data
Public Sub LoadFile(byVal Filename as String)
If My.Computer.FileSystem.FileExists(Filename)then
Dim XMLString as String = My.Computer.FileSystem.ReadAllText(Filename)
Me = Deserialize(XMLString, Gettype(datatable))
Else
Throw New ArguementException("File not found!")
End if
End Sub
End Class
Any help would be greatly appreciated!
Comment