What is the use of Checked keyword in c-sharp ?
I was in a session and someone told me about checked keyword.I become stuck in this ?? kindly tell me about this ...
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Ammar ShaukatRank #592 · 4.1K reputationPosted Feb 24, 2016, 10:16 PM EST
When you wrap a statement (or block of statements) within the scope of checked keyword,
C# compiler emits additional CIL instructions that test for overflow conditions that may result
when adding , multiplying , subtracting and dividing two numerical data types.
If an overflow has occurred, you'll receive a runtime exception: System.OverflowException