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 ...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ammar ShaukatPosted Feb 25, 2016, 3:16 AM
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