When must we use checked
operator in C#?
Is it only suitable for exception handling?
From The checked and unchecked operators
The checked and unchecked operators are used to control the overflow checking context for integral-type arithmetic operations and conversions.
In a checked context, if an expression produces a value that is outside the range of the destination type, the result depends on whether the expression is constant or non-constant. Constant expressions cause compile time errors, while non-constant expressions are evaluated at run time and raise exceptions.
In an unchecked context, if an expression produces a value that is outside the range of the destination type, the result is truncated.
checked, unchecked