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 |
Is xml tags are case sensitive?
Explain the mechanism of VB.NET/C# achieve polymorphism?
Okay, so an int is a value type, and a class is a reference type. How can int be derived from object?
What is an escape sequence in c#?
how to Create a datagridview control with check box column with 8rows in it, the maximum number of check boxes checked should be 3, when user checks the 4th corresponding message should be displayed and check box should be checked. User can uncheck the checked boxes Note: read-only property should not be used
can we assign null value to value type in c#?
12 Answers Idea, Microsoft, Wipro,
Can you instantiate an abstract class c#?
What is action c#?
Is there a way to force garbage collection?
Structs are not reference types. Can structs have constructors?
Is namespace a class?
How does c# achieve polymorphism?