If I have an enum like so:
enum Beer
{
Bud = 10,
Stella = 20,
Unknown
}
Why does it not throw an exception when casting an int that is outside of these values to a type of Beer?
For example the following code doesn't throw an exception, it outputs '50' to the console:
int i = 50;
var b = (Beer) i;
Console.WriteLine(b.ToString());
I find this strange...can anyone clarify?