13.07.2015 Views

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>C#</strong> LANGUAGE SPECIFICATIONequality-expression:relational-expressionequality-expression == relational-expressionequality-expression != relational-expressionThe is operator is described in §14.9.9 and the as operator is described in §14.9.10.The ==, !=, , = operators are comparison operators. For an operation of the form x op y,where op is a comparison operator, overload resolution (§14.2.4) is applied to select a specific operatorimplementation. The operands are converted to the parameter types of the selected operator, and the type ofthe result is the return type of the operator.The predefined comparison operators are described in the following sections. All predefined comparisonoperators return a result of type bool, as described in the following table.Operationx == yx != yx < yx > yx = yResulttrue if x is equal to y, false otherwisetrue if x is not equal to y, false otherwisetrue if x is less than y, false otherwisetrue if x is greater than y, false otherwisetrue if x is less than or equal to y, false otherwisetrue if x is greater than or equal to y, false otherwise14.9.1 Integer comparison operatorsThe predefined integer comparison operators are:bool operator ==(int x, int y);bool operator ==(uint x, uint y);bool operator ==(long x, long y);bool operator ==(ulong x, ulong y);bool operator !=(int x, int y);bool operator !=(uint x, uint y);bool operator !=(long x, long y);bool operator !=(ulong x, ulong y);bool operator (ulong x, ulong y);bool operator =(ulong x, ulong y);Each of these operators compares the numeric values of the two integer operands and returns a bool valuethat indicates whether the particular relation is true or false.164

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!