Hi at all,
I try to serialize an Object that has an array inside its, like this:
class TerritoriesWrapper{
var list : Territory[];
function TerritoriesWrapper(){
return;
}
function TerritoriesWrapper(array : Territory[]){
this.list = array;
return;
}
}
with the following code:
var temp :TerritoriesWrapper = new TerritoriesWrapper(territories);
var xml = new XmlSerializer(TerritoriesWrapper);
xml.Serialize(this.stream,temp);
But I get this error:
InvalidOperationException: The type of the argument object is not primitive.
System.Xml.Serialization.XmlSerializer.Serialize (System.IO.TextWriter textWriter, System.Object o)
Save.saveTerritories (.Territory[] territories) [0x00017] (at Assets/Scripts/SaveAndLoadClasses.js:27)
MyGame.saveGame (.Territory[] territories) [0x00000] (at Assets/Scripts/GameClass.js:202)
SceneController+NextPlayer$136+$.MoveNext () (at Assets/Scripts/SceneController.js:284 at System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive (System.String name, System.String ns, System.Object o, Boolean xsiType) [0x00000])
Doesn’t possible to serialize Object with array of object or I have wrong somethings?
Thank at all in advance.