The documentation for BinaryWriter.Write(string) states that it writes a string with a length prefix to this stream. Overloading for Write(char[]) does not have such a prefix.
It seems to me that the extra data is the length.
EDIT:
To be more explicit, use a Reflector. You will see that it has this piece of code as part of the Write(string) method:
this.Write7BitEncodedInt(byteCount);
This is a method of encoding an integer using the least possible number of bytes. For short lines (which we will use every day, which are less than 128 characters), it can be represented with a single byte. For longer strings, it starts using more bytes.
Here is the code for this function just in case you are interested:
protected void Write7BitEncodedInt(int value) { uint num = (uint) value; while (num >= 0x80) { this.Write((byte) (num | 0x80)); num = num >> 7; } this.Write((byte) num); }
After a length prefix using this encoding, it writes bytes for characters in the desired encoding.
source share