- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Chaining comparison operators in C#
C# has many operators that work on the left-right and righ-left associativity.
Chanining depends on the left-to-right associativity on operators with same precedence.
Operator precedence determines the grouping of terms in an expression. This affects evaluation of an expression. Certain operators have higher precedence than others do; for example, the multiplication operator has higher precedence than the addition operator.
The operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom. Within an expression, higher precedence operators are evaluated first.
To check whether a string is null or not, you can write it as −
if (str == null == false)
The associative of equality operators like == and != is from left to right. Therefore, above it will automatically check for the following first −
str==null