Why should I explicitly surround with “unchecked”?
Is there anyone able to explain me this strange behavior? int i = 0x1234; byte b1 = (byte)i; byte b2 = (byte)0x1234; //error: const value '4660' can't convert to byte (use unchecked) byte b3 = unchecked((byte)0x1234); byte b4 = checked((byte)i); //throws byte b5 = (byte)(int)0x1234; //error: same as above NOTE: It's an empty Console application, with NO arithmetic checking enabled (as default is). Thank you everybody in advance. EDIT: I supposed to be clear enough, but not for all. I do know that a word can't fit into a byte. But, by default, a C# program allows certain "dangerous" operations,