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

Advantages of c# over vb.net?

3 Answers   HCL, Syntel,


Explain constructor.

7 Answers   Wipro,


what is the index value of the first element in an array?

0 Answers  


Does c# provide copy constructor?

0 Answers  


Why can?t you specify the accessibility modifier for methods inside the interface?

3 Answers   Mind Tree, Siebel Systems,






What are lambda expressions used for?

1 Answers  


Can we declare private class in c#?

0 Answers  


How u make an application remotable?

1 Answers  


How do partial classes work in c#?

0 Answers  


What is or operator in c#?

0 Answers  


What is an object pool in .net?

0 Answers  


What is serialization in dot net?

0 Answers  


Categories