I am heavily using byte array to transfer objects, primitive data, over the network and back. I adapt java\'s approach, by having a type implement ISerializable, which cont
If you are after simple, lightweight and efficient binary serialization, consider protobuf-net; based on google's protocol buffers format, but implemented from scratch for typical .NET usage. In particular, it can be used either standalone (via protobuf-net's Serializer
), or via BinaryFormatter
by implementing ISerializable
(and delegating to Serializer
).
Apart from being efficient, this format is designed to be extensible and portable (i.e. compatible with java/php/C++ "protocol buffers" implementations), unlike BinaryFormatter that is both implementation-specific and version-intolerant. And it means you don't have to mess around writing any serialization code...