Use of Checked and UnChecked operators?
Answers were Sorted based on User's Feedback
Answer / jackir
when value of a datatype excided its limitaion then its
call overflow to avoid this problem we use ckecked and
unchecked
syntax
return unchecked(x+y);
return checked(x+y);
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / hridya
In a checked context, if the operation is a constant
expression a compile-time error occurs. Otherwise, when the
operation is performed at run-time, a
System.OverflowException is thrown.
In an unchecked context, the result is truncated by
discarding any high-order bits that do not fit in the
destination type.
Is This Answer Correct ? | 4 Yes | 0 No |
What is singleordefault?
How main method is called in c#?
Can an interface inherit an interface
What is lazy class in c#?
What is IL / CIL / MSIL?
what is a callback function?
What’s a strong name?
Can you use foreach iteration on arrays in c#?
What are events in C#?
What is the default boolean value in c#?
What framework is used for performance testing/load testing?
What is ildasm.exe used for?