Possible Duplicate:
What happens when you cast from short to byte in C#?
Can someone explain what's happening when casting a value to a byte, if it's outside the range of min/max byte? It seems to be taking the integer value and modulo it with 255. I'm trying to understand the reason for why this doesn't throw an exception.
int i = 5000;
byte b = (byte)i;
Console.WriteLine(b); // outputs 136