Use of Checked and UnChecked operators?

Answers were Sorted based on User's Feedback



Use of Checked and UnChecked operators?..

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

Use of Checked and UnChecked operators?..

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

Post New Answer

More C Sharp Interview Questions

What is singleordefault?

0 Answers  


How main method is called in c#?

0 Answers  


Can an interface inherit an interface

1 Answers   Synechron,


What is lazy class in c#?

0 Answers  


What is IL / CIL / MSIL?

0 Answers   CitiusTech,






what is a callback function?

4 Answers  


What’s a strong name?

0 Answers  


Can you use foreach iteration on arrays in c#?

0 Answers  


What are events in C#?

0 Answers   CDC,


What is the default boolean value in c#?

0 Answers  


What framework is used for performance testing/load testing?

0 Answers   TCS,


What is ildasm.exe used for?

0 Answers  


Categories