C# Operators

C# is just like other programming languages like C, C++, etc. C# is also providing some common operators for specifying the compiler to perform specific manipulations or changes like mathematical operations, logical operations, etc., on the data.

List of C# Operators and their description

C# Operators are basically of three types depending on the number of operands. The operand is nothing but the data on which it is working on.

C# OperatorsDescription
ArithmeticThe Arithmetic Operators like +, -, *, /, and % are useful to tell the compiler to perform specific mathematical calculations on the operands like addition, subtraction, multiplication, division, and modulus, respectively.
Relational= =, >, >=, <, <=, != generally checks the relation by comparing two variables and gives True or False (Boolean) result. These Relational operators are useful in controlling the program flow.
Logical&&, ||, ! allows us to check whether multiple operations are true. Usually, these C# Logical Operators are useful in combination with the relational.
Bitwise&, |, ^, ~ perform operations on bits. These will take the decimal input and will convert decimal to binary, performs bitwise operations, and finally, the binary result is converted to decimal and given as output.
Shift>>, << performs the right shift or left shift on the left operand by moving the left or right side by the number of bits(specified in the right operand).
Unary++, – – are unary as these work on a single operand. These are also called C# increment and decrement operators.
Assignment=, + =, – =, / =, % = are used to assign values to the variables. The most commonly used in the real-time environment is the ‘=’ operator.
Ternary?: is also called a conditional operator that works on three operands. 
If the statement is true ? then x : else y
Null CoalescingVariable x= variable y ?? value.
Variable x will be assigned a value if variable y is null; otherwise, the value in the variable y is assigned.
Categories C#