How does DataSet.ReadXml() deserialize XML into the current dataset instance?

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,081
Programming Experience
10+
In mimicking the dataset's serializee and deserialize, i'm trying to make a sub called ReadXml that will take a stream to read from, and deserialize all the data into the current instance upon which readxml is called.

For serializing, this was easy:

VB.NET:
Dim xs as XmlSerializer
xs.Serialize(theStream, Me, blahblah)

but how does the reverse work, populating an existing instance rather than creating a new one?
I can happily make a factory that will read the stream and crank out a new object, i just not sure how to make the existing object get populated, seeing as Deserialize() returns a newly deserialized object?

Does dataset deserialize and capture the new object, then manually clone all the entries into itself?
 
Have you tried Reflector looking through the code for Dataset class? (hint, it also uses a friend helper class XmlDataLoader)
 
Back
Top