I am trying to get the BinaryLibrary value stored in a binary serialization (BinaryFormatter). I've been following outline from here.
I tried a naive:
FileStream fs = new FileStream("binary.dat", FileMode.Open);
try
{
BinaryFormatter formatter = new BinaryFormatter();
object obj = formatter.Deserialize(fs);
}
catch (SerializationException e)
{
Console.WriteLine("Failed to deserialize. Reason: " + e.Message);
throw;
}
finally
{
fs.Close();
}
Using the debugger I cannot find anything under obj or formatter. Where is the BinaryLibrary value stored ? How can I access it ?
The API allows one to register a binder:
So simply register it:
where definition is:
Typical outputs:
or: