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
Зареєструйся Зараз
або Підпишись на майбутні тести