I think you may be able to do this by implementing the ISerializable
interface and adding a serialization constructor. You may still have
problems with versioning though.
protected MyClass(SerializationInfo info, StreamingContext context)
{
this.MyString = info.GetString("MyString");
this.MyInteger = info.GetInt32("MyInteger");
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("MyString", string);
info.AddValue("MyInteger", int);
}
"Steve Teeples" wrote:
I have a simple class that is Serializable() so that I can read/write it
to/from disk. Functionally it works great. However, I soon learned that if
I added a field or property to the class that I could no longer read the
"old" data that was written. The error I get says that the component number
no longer matches. Is there a way to tell the reader to ignore the mismatch
and continue reading the data that is currently in the file?
--
Steve