I'm new to object serialization, and in the course of my learning how to read from and write to a file (deserialize and serialize) using BinaryFormatter
, I came across BinaryReader
and BinaryWriter
, which seemed to be doing the same thing.
Is there some subtle difference between BinaryFormatter.Serialize()
and BinaryWriter
? Or is BinaryWriter
just a more compact way performing the the same action as BinaryFormatter.Serialize()
?
BinaryWriter
is used to write primitive types in binary to a stream and supports writing strings in a specific encoding. BinaryFromatter
is responsible for serializing an entire object or graph of connected objects into binary format. So, I suppose you can say BinaryWriter
is a much more elementary form of something like BinaryFormatter
.
I got this information here: BinaryWriter & BinaryFormatter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With