Extracted from
MSDN : Nullable Types
A comparison operator (==, !=, < , >, < =, >=) has a lifted form when the operand types are both non-nullable value types and the result type is bool. The lifted form of a comparison operator is formed by adding a ? modifier to each operand type (but not to the result type). Lifted forms of the == and != operators consider two null values equal, and a null value unequal to a non-null value. Lifted forms of the < , >, < =, and >= operators return false if one or both operands are null.
What this means is this:
|
int? x=null;
int? y=null;
x==y // this is true x>=y // this is false x< =y // this is false
| |
Why? If they are equal why >= and < = returns false? I'm sure they have a good reason for this but I'm not getting it. If you have any idea please post a comment.
Posted
12-11-2005 11:05
por
Daniel Vinagre