Binary serializer - change location of serializable class with serialized files


I have a class that represents search criteria used to build queries against a datastore. This class is serializable, allowing class instances to be saved to disk and reloaded, providing the business-level feature of saving searches to re-use them.

Here's the problem; I recently changed the location of the class that can be serialized. I didn't change the structure of said class, I only moved it from one project (which no longer exists by its original name) to another. In doing so I realized that I just broke the deserialization of files based on the class as it existed in its prior location.

If possible, I need to be able to "convert" these files. Though the files are in binary format, much of the file is readable as plain text, including the now-invalid namespace. However, just changing the text of said file that I can see will corrupt it, so obviously I'm missing something.

Is there a way to either update the file as some sort of batch process, or point the serializer at the new class location, so the files can be deserialized?

You can create a small program having two copies of the serializable class in each namespace. Then you can read the data from the files using the class in the old namespace and for each instance create an instance of the class in the new namespace where you copy all the fields. You can then serialize the new classes back to files.