What is the difference between checked and unchecked?

后端 未结 5 1149
情话喂你
情话喂你 2021-01-17 10:01

What is the difference between

checked(a + b)

and

unchecked(a + b)

?

5条回答
  •  遇见更好的自我
    2021-01-17 10:25

    Those are operators that check (or do not check) for overflow in the resulting numerical operation. In the checked case, an OverflowException exception is raised if the result of the operation exceeds the minimum or maximum value allowed for the datatype.

    More information is available from MSDN.

提交回复
热议问题