I am using BinaryWriter in my code, here is my code:
static void Main(string[] args)
{
FileInfo file = new FileInfo(@"F:\testfile");
if (file.Exists) file.Delete();
using (BinaryWriter bw = new BinaryWriter(file.Create()))
{
ushort a = 1024;
ushort b = 2048;
bw.Write(a);
bw.Write(b);
bw.Write(a);
bw.Write(b);
}
Console.ReadLine();
}
But the hex of the output file is :
Isn't that 0x0004 = 4? why?