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 a static class in c#?

0 Answers  


Explain metadata in c#.

0 Answers  


what is bubbled event ? give suitable example in code vice with demo

2 Answers  


What is the .NET collection class that allows an element to be accessed using a unique key?

0 Answers   Siebel,


What does public mean in c#?

0 Answers  






Can dictionary have duplicate keys c#?

0 Answers  


What is difference between ienumerable and list in c#?

0 Answers  


what are ways to debug the code step by step except using breakpoints?

1 Answers  


Can you inherit multiple classes in c#?

0 Answers  


What does private void mean in c#?

0 Answers  


This is Kishore i am MCA graduate i have percentage less(52%) in my 10th still i completed .NET course any body tell me how to put fake experience with my BSC degree if you do not mind tell me some fake certificates giving consultencies names in Chennai,Bangalore

5 Answers  


What is the difference between disposing of () and finalize() methods in c#?

0 Answers  


Categories