BinaryWriter will do the job for you.

Here is a simple sample
Code: C#
FileStream  fs = File.Create(Server.MapPath("test.bin"));
BinaryWriter bw = new BinaryWriter(fs);

int i = 10;
bw.Write(i);

bw.Close();
fs.Close();