The Input and output streams section of the Microsoft Bond documentation provides this sample code to deserialize from a file:
using (var stream = new FileStream("example.bin", FileMode.Open))
{
var input = new InputStream(stream);
var reader = new CompactBinaryReader<InputStream>(input);
var example = Deserialize<Example>.From(reader);
}
I tried the reverse to serialize to file, but nothing is written to the file.
using (var stream = new FileStream("example.bin", FileMode.Create))
{
var output = new OutputStream(stream);
var writer = new CompactBinaryWriter<OutputStream>(output);
Serialize.To(writer, example);
}
Any ideas?