Deserialization problems[resolved]
Hi there.
I had this issue before but was resolved adding extra types, and I was serializing an ArrayList than a Generic list type LIST<T>
Everytime I try to deserialize I get the error:
"<Bookmark xmlns=''> was not expected."
It serializes correctly. What am I doing wrong?
deserialization:
Code:
Bookmark[] theBookmarkObject = new Bookmark[] { };
XmlSerializer theXmlDeserializer = new XmlSerializer(typeof(Bookmark[]));
try
{
if (File.Exists(Environment.CurrentDirectory + @"\" + theSerializedBookmarksFilename))
{
using (StreamReader theSerializerReader = new StreamReader(Environment.CurrentDirectory + @"\" + theSerializedBookmarksFilename))
{
theBookmarkObject = (Bookmark[])theXmlDeserializer.Deserialize(theSerializerReader); //here
}
}
return theBookmarkObject;
}
....
Re: Deserialization problems
solved it.
should have just been
theBookmarkObject = (Bookmark)theXmlDeserializer.Deserialize......