What does `{0:X2}` mean in this code sample?
This uses the same format as String.Format(). Check out the following reference:
http://msdn.microsoft.com/en-us/library/fht0f5be.aspx
- X = Hexadecimal format
- 2 = 2 characters
Beware the length specified is not respected if the number is too large to fit the length.
long a = 123456789;
Console.Write("{0:X2}", a);
-> 75BCD15
This is especially important if you want to show negative hex numbers where all the high bits are set to 1's.
long a = -1;
Console.Write("{0:X2}", a);
-> FFFFFFFFFFFFFFFF