For example:
Here’s a simple class.
class Hero
{
public string faction;
public string name;
public HeroType herotype;
}
And here’s the XML counterpart.
<Hero>
<android>
<Faction>evil</Faction>
<nombre>android</nombre>
</android>
</Hero>
Do the attributes have to be exactly the same in order to serialize information?
My main purpose is to “load” information to the Hero class with information from my XML file.
You can decorate your fields with [XmlElement(…)] to specify an alternate name. Also they do not have to be in the same order. However the Xml you specified doesn’t fit the structure of the classes you specified.
Modify your Xml to something like this: