The C # compiler does not know that BigInteger is logically an "integral type". It just sees a user type with explicit user-defined conversion to long. From the point of view of the compiler
long long2 = (long)bigInt;
exactly the same as:
long long2 = someObject.SomeMethodWithAFunnyNameThatReturnsALong();
He has no way to get inside this method and tell him to stop throwing exceptions.
But when the compiler sees
int x = (int) someLong;
the compiler generates the code that performs the conversion, so it can choose to create verified or unverified code as it sees fit.
Remember that "checked" and "unchecked" do not affect runtime; it is not like the CLR goes into "unchecked mode" when control goes into an uncontrolled context. "checked" and "unchecked" are instructions for the compiler about what code is generated inside the block. They only affect compilation time, and the compilation of the conversion of BigInt to long has already occurred. His behavior is fixed.
source share