Is this possible?
Public Class Foo
public var as string
public sub Load(byval filename as string)
'This is done
[...]
oItem = [...] 'Code to deserialize
me = oItem 'THIS LINE
end sub
end class
So that you can load foo from the serialized file like so:
Public Sub Main
Dim f as Foo = new Foo()
f.load("myFile")
end sub
Up until now i’ve had a function that that returns Foo as Object (I’m trying to make the serialize / deserialize process general so I can just copy and paste and avoid explicitly setting each variable)
No, what you want to do in your case is have Load be a Shared Function that returns the newly created item.
More like:
Also, rather than embedding the deserialization directly into each class, you can have a general purpose method, such as:
which you can then call as: