Missing BinaryStream.Write(byte)
BinaryStream
has all the usual overloaded Write()
variants as the original BinaryWriter
except for one: Write(byte).
You probably left it out because it doesn't need endianness handling and you provided WriteByte()
, anyway. However, this omission leads to a very nasty and hard to spot bug: if you write
foreach (byte item in some_byte_array)
stream.Write(item);
guess what will be called: Write(short)
. Twice as many bytes written and the apple cart upset. Yes, you could also call
stream.Write(some_byte_array)
directly but that doesn't help until you finally realize what went wrong with the original approach. :-)
Edited by deakjahn