Heya all,
I was wondering what your opinion about this would be. I'm trying to convert an xml file to a .net object. It's a xml file from the World of Warcraft armory. Here is an example.
<?xml version="1.0" encoding="UTF-8"?>
<baseStats>
<strength attack="48" base="48" block="-1" effective="58"/>
<agility armor="114" attack="-1" base="47" critHitPercent="4.27" effective="57"/>
<stamina base="70" effective="1186" health="11680" petBonus="-1"/>
<intellect base="198" critHitPercent="10.41" effective="1529" mana="22655" petBonus="-1"/>
<spirit base="190" effective="770" healthRegen="39" manaRegen="503"/>
<armor base="2150" effective="2150" percent="12.37" petBonus="-1"/>
</baseStats>
I've thought of 2 ways to convert this to an object and I'd like to hear your opinion about it. Ill show them.
class BaseStats{
public int StrengthAttack{get;set;}
public int StrengthBase{get;set;}
public int StrengthBlock{get;set;}
...
public int ArmorBase{get;set;}
public int ArmorEffective{get;set;}
...
}
or
class BaseStats{
public Strength Strength{get;set;}
public Armor Armor{get;set;}
public class Strength{
public int Attack{get;set;}
public int Base{get;set;}
public int Block{get;set;}
}
public class Armor{
public int Base{get;set;}
public int Effective{get;set;}
}
}
Do you see what I'm trying here. What would be your opinion about each of those ways. Or can you think of any others?