Why does a const int implicitly cast to a byte, but a variable int does not?
问题 The following program will not compile: class Program { static void Main(string[] args) { int x = 50; Byte[] y = new Byte[3] { x, x, x }; } } Not surprisingly, I will get the error Cannot implicitly convert type 'int' to 'byte' However, if I make x a const, then it will compile: class Program { public const int x = 50; static void Main(string[] args) { Byte[] y = new Byte[3] { x, x, x }; } } I'm curious as to what's going on here. If an int cannot be implicitly cast to a byte, does the