What will be displayed as a result of the following code execution:
 
Decimal x = Decimal.MaxValue; 

unchecked 
{
    x++; 
} 

if (x == Decimal.MinValue) 
    Console.WriteLine("MinValue"); 
else if (x == Decimal.MaxValue) 
     Console.WriteLine("MaxValue"); 
else 
    Console.WriteLine("Something else");
 
Explanation
Decimal type is not a primitive for CLR, and there are no ready IL instructions for all operations on this type. Decimal contains static methods Add, Subtract, Multiply, Divide, and overloaded operators +, -, *, / v, etc., and operator checked / unchecked does not specify the behavior of the method that is called inside of its block.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты