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

public void A() { int x; x = 8; x *= 4 + 8 / 2; } Given the above code, what is the value of "x"?

8 Answers  


how to use msflexgrid in asp.net

1 Answers   nSoft, Unichem,


What are the advantages of using assemble language programming?

0 Answers   Ittiam Systems,


Which types of inheritances does c# support?

0 Answers  


Distinguish between a class and struct?

0 Answers  






What connections does Microsoft SQL Server support?

3 Answers  


Why do we use static class in c#?

0 Answers  


What are the access modifiers in c#?

0 Answers  


Where do we use static class in c#?

0 Answers  


Explain the difference between .net and c#?

0 Answers  


What is eager and lazy loading in c#?

0 Answers  


Can we create extension method for interface?

0 Answers  


Categories