I recently had a discussion with a colleague about serialization of byte data over a network.
He used the BinaryFormatter
class to "unparse" the byte data I was sending to him. This did not work and he obviously had exceptional... exceptions. Binaryformatter
could not "unparse" the data correctly since my data was simply a byte array.
His motivation for BinaryFormatter
was platform independence. I am not persuaded of such a stance. When we both used BinaryReader
or BinaryWriter
, things worked well in code land.
What is the use therefore of BinaryFormatter
and should I look at using it in each scenario wherever I need to send bytes over the wire?