I have a project with a few types that I binary-serialize (BinaryFormatter) to files. I’d now like to create a second project which allows admins to temporarily decode those files into a more readable XML format (e.g., using XmlSerializer).
I could deserialize them into an object of the original type, then reserialize them, but is it at all possible to
- skip the deserialization (at least in my own code), and
- better yet, not have to reference the type at all in my decoder tool?
If you are referring to .NET’s native binary serialization (
BinaryFormatter), the problem is that it saves your object (along with all the necessary metadata for deserialization) using an undocumented format (AFAIK).If you really want to try doing it without deserialization, you can check this article, which appears to have analyzed its format (but the author himself states that it might be incomplete). But my opinion is that it’s far too much trouble.