Jack,
If I needed to write integers to a binary file, I would simply write the
integer, as it is already Binary!
Have a look at the System.IO.BinaryReader & System.IO.BinaryWriter classes.
They allow you to read & write binary files, there are overloaded Write
methods that will read & write integers.
Your example is demonstrating how to convert an integer into Hex digits, hex
digits are not binary per se. You can use Convert.ToString(-1s, 16) to
convert a Short -1 to hex, likewise you can use Convert.ToInt16(s, 16) to
convert a hex string to a Short. You would use Convert.ToInt32 to convert to
an Integer.
Hope this helps
Jay