Click to See Complete Forum and Search --> : XML error


roflshark
August 9th, 2011, 02:25 AM
Need help here. Trying to use serialization to save my array of monsters but got this error.


An unhandled exception of type 'System.InvalidOperationException' occurred in System.Xml.dll

Additional information: There was an error generating the XML document.


Here's my code:

public void Save()
{
using (IsolatedStorageFile saveGameFile = IsolatedStorageFile.GetUserStoreForApplication())
using (IsolatedStorageFileStream SaveGameStream = new IsolatedStorageFileStream("monster.dat", FileMode.OpenOrCreate, saveGameFile))
{
XmlSerializer serializer = new XmlSerializer(typeof(List<Monster>));
serializer.Serialize(SaveGameStream, _lMonster); <------ error on this line
}
}

Arjay
August 15th, 2011, 05:03 PM
Is _IMonster the same type as typeof(List<Monster>)?