Checked statement in c#
In this article we will learn about Checked statement in C#.
The checked statement is an Exception statement. Checked statement is used to control an exception, this exception is raised whenever stack overflow (or underflow) occurs due to type conversion issues. It can be used as an operator or a statement according to the following forms.
The checked statement:
static void Main(string args)
// assign maximum value
num = int.MaxValue;
// forces stack overflow exception
num = num + 1;
catch (Exception e)
The output of following program