An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. C# has rich set of built – in operators and provide the following type of operators –
- Arithmetic Operators
- Relational Operators
- Logical and Bitwise Operators
- Assignment Operators
- Other Operators
Several common arithmetic operators are allowed in C#.
|%||Remainder or modulo|
|++||Increment by 1|
|—||Decrement by 1|
Relational Operators are used for comparison purpose in conditional statements. Common relational operators in c# are :
|!=||Un – equality check|
|>=||Greater than or equal to|
|<=||Less than or equal to|
Relational operators always result in a Boolean statement; either true or false.
Logical and Bitwise Operators
These operators are used for logical and bitwise calculations. Common logical and bitwise operators in C# are:
|&&||“Logical ” or ” short circuit ” AND|
|||||” Logical” or ” short circuit ” OR|
The operators &, | and ^ are rarely used in usual programming practice. The NOT operator is used to negate a Boolean or bitwise expression.
Assignment Operators are used to assign values to variables. Common assignment operators in C# are :
The equal (=) operator is used to assign value to an object.
There are some other operators present in c#. A short description of these is given below:-
|<<||Left shift bitwise operator|
|>>||Right shift bitwise operator|
|.||Member access for objects|
|||Index operator used in arrays and collections|