It is very interesting to me why this code will not give an exception and 12356 will be output to the console? What is the meaning of this behavior enum?
enum Dummy { D1 = 123, D2 = 1234, D3 }
class Program
{
static void Main(string[] args)
{
Dummy d = (Dummy)12356;
Console.WriteLine((int)d);
Console.ReadKey();
}
}
Is this a bug or a feature?