14.9 Relational & type-testing operators
来源:互联网 发布:互联网商业模式知乎 编辑:程序博客网 时间:2024/05/22 16:01
The ==, !=, <, >, <=, >=, is and as operators are called the relational and
type-testing operators.
relational-expression:
shift-expression
relational-expression < shift-expression
relational-expression > shift-expression
relational-expression <= shift-expression
relational-expression >= shift-expression
relational-expression is type
relational-expression as type
C# LANGUAGE SPECIFICATION
164
equality-expression:
relational-expression
equality-expression == relational-expression
equality-expression != relational-expression
The is operator is described in ?4.9.9 and the as operator is described in
?4.9.10.
The ==, !=, <, >, <= and >= operators are comparison operators. For an
operation of the form x op y,
where op is a comparison operator, overload resolution (?4.2.4) is applied
to select a specific operator
implementation. The operands are converted to the parameter types of the
selected operator, and the type of
the result is the return type of the operator.
The predefined comparison operators are described in the following
sections. All predefined comparison
operators return a result of type bool, as described in the following table.
Operation Result
x == y true if x is equal to y, false otherwise
x != y true if x is not equal to y, false otherwise
x < y true if x is less than y, false otherwise
x > y true if x is greater than y, false otherwise
x <= y true if x is less than or equal to y, false otherwise
x >= y true if x is greater than or equal to y, false otherwise
type-testing operators.
relational-expression:
shift-expression
relational-expression < shift-expression
relational-expression > shift-expression
relational-expression <= shift-expression
relational-expression >= shift-expression
relational-expression is type
relational-expression as type
C# LANGUAGE SPECIFICATION
164
equality-expression:
relational-expression
equality-expression == relational-expression
equality-expression != relational-expression
The is operator is described in ?4.9.9 and the as operator is described in
?4.9.10.
The ==, !=, <, >, <= and >= operators are comparison operators. For an
operation of the form x op y,
where op is a comparison operator, overload resolution (?4.2.4) is applied
to select a specific operator
implementation. The operands are converted to the parameter types of the
selected operator, and the type of
the result is the return type of the operator.
The predefined comparison operators are described in the following
sections. All predefined comparison
operators return a result of type bool, as described in the following table.
Operation Result
x == y true if x is equal to y, false otherwise
x != y true if x is not equal to y, false otherwise
x < y true if x is less than y, false otherwise
x > y true if x is greater than y, false otherwise
x <= y true if x is less than or equal to y, false otherwise
x >= y true if x is greater than or equal to y, false otherwise
- 14.9 Relational & type-testing operators
- While relational operators
- STL relational operators (vector)
- Day8-25.Relational operators
- 14.3. Arithmetic and Relational Operators
- 14.9.6 Reference type equality operators
- 4 type cast operators in C++
- Type conversions with implicit and explicit operators
- DataTable Relational Operators in C# - INTERSECT Method, DISTINCT helper method & an apology
- Operators
- Operators
- Operators
- Operators
- C++ 类型转换操作符(Type Conversion Operators)
- Professional JS(3.4.7The Object Type&3.5Operators)
- 14.9.1 Integer comparison operators
- 14.9.3 Decimal comparison operators
- 14.9.4 Boolean equality operators
- JAVA编程的部份实用技巧
- 白天,还是上不了网。
- 又一天熬到半夜
- ASP分页函数
- 关于session的详细解释
- 14.9 Relational & type-testing operators
- 14.9.1 Integer comparison operators
- 14.9.2 Floating-point comparison operators
- 14.9.3 Decimal comparison operators
- 14.9.4 Boolean equality operators
- 14.9.5 Enumeration comparison operators
- 14.9.6 Reference type equality operators
- 14.9.7 String equality operators
- 14.9.8 Delegate equality operators