Relational Operators

Another category of operators consists of relational operators, used to perform equality checks or comparisons. The meaning of the following operators should be easy to guess:

==  !=  <  <=  >  >=

Built-in types, like the numeric types, support these operators, each of which returns a Boolean value to indicate the result of the check. All of those operators can be overloaded by types, as well, as you will see in Chapter 13, “Operator Overloading and Conversions.”

Note: Floating-Point Numbers

Floating-point numbers have some weird values, such as NaN, infinities, and positive- and negative-zero representations. In compliance with IEEE 754, the CLR implements the meaning for relational checks on floating-point numbers based ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.