Deserialize int arrays from XML file?

One of the way could be creating another property that would take space delimited set for serialization purposes. For example.

One of the way could be creating another property that would take space delimited set for serialization purposes. For example, class Player { public string Name; XmlIgnore public int Spells; XmlElement("Spells") public string SpellsString { get { // array to space delimited string } set { // string to array conversion } } }.

Thanks, this is what I was looking for! – Stefan Apr 18 at 12:34.

Class Player { public string Name { get; set; } public string SpellData { get; set; } public int Spells() { return SpellData. Split(" "). Select(n=>int.

Parse(n)).ToArray(); }; } Something like that will make your xml data look the way you want to, since on the string and not the function would be serialized. But why do you care what your xml looks like? The other xml is a lot cleaner.

I want the xml to look like that because in my project I read a collision layer for a map and it is much better to view the matrix elements delimited by spaces instead of "" . – Stefan Apr 18 at 12:08.

If you store the spells in a space delimited string in the XML, you can use the following code to convert it to an integer list: var spellsAsIntegers = spellsAsString. Split(' '). Select(n => int.

Parse(n)).ToList().

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions