Game Development Community

Public arraylists problem

by Doug Barnes · in Torque X 2D · 11/29/2007 (11:17 am) · 2 replies

Hey everyone,

OK, so heres the problem. I added a public array list to my game in the game.cs file. When I try to build it i get an error that says it's unable to deserialize the arraylist for some reason. But then if I hit abort to the error and rebuild again the program runs without a problem. If anyone knows whats going on here your help would be greatly appreciated.

Thanks in advance,
Doug

#1
11/29/2007 (1:21 pm)
By array list, do you mean array or list? lists (List) can be deserialized just fine, while arrays ([]) can't. Since you're getting that error, I'm assuming it's an array. If you want the property to be ignored by the deserializer, add the XmlIgnore attribute to it. If you want it to be deserialized, you have to use a list.

XmlIgnore is used like this:

[XmlIgnore]
public int myVariable; // this could also be a property