XML: Deserializing Objects

  • Thread starter Thread starter Justin Armstrong
  • Start date Start date
J

Justin Armstrong

I'm having difficulties deserializing some objects.
Consider the following example of what I'm trying to do:
----------------------------------------------------------
class Person
{
string name;
}

class Info
{
string A;
string B;
}
----------------------------------------------------------
Don't mind the ommitted XML tags or serialize functions.
The resultant XML file is a combination of a serialized
Info object and a serialized array of Person objects,
like so:
----------------------------------------------------------
<xml ...?>
<global>
<Info ...>
<stringA>blah</stringA>
<stringB>blah</stringB>
</info>
<ArrayOfPerson ...>
<Person>
<name>bob</name>
</Person>
 
The solution is to use a new XMLSerializer. Apparently
you can't use the same serializer object for two
different object types.
 
Back
Top