There is no way this would be guranteed - Hashcode is not even guaranteed and these are used in the serialization process.
If you want gurantees you will have to write your own BinaryFormater. What you are doing is right - and is likely to work with upgrades its just there will be no gurantee that code will not change. Ben -----Original Message----- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED]]On Behalf Of Paul Currit Sent: Saturday, 6 July 2002 2:31 AM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Serialization and assembly version redirection I am persisting objects to a database using the BinaryFormatter. When inserting new objects, I call BinaryFormatter.Serialize and store the object as a byte array in a database table. When getting an object out of the table I use BinaryFormatter.Deserialize to convert the byte array back into the object. If the version of the assembly containing the serializable type changes, can the serialized object in the database be deserialized with the newer version. In other words, is there any way to deserialize objects that were originally serialized under a different version number, as long as the type's interface hasn't changed? Is this even an appropriate use of the BinaryFormatter, since it is typically used for ephemeral objects and not persistence? I've tried using the <assemblyBinding> config section, but in my tests, deserialization is ignoring the assembly version redirection. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
