Operators in C#
By Jean-Claude Colette Jun 13, 2020
Here we present the operators of the C# language and give some examples of use. We distinguish several categories of operators: assignment, arithmetic, logical, relational and bitwise operators.
In C#, an operator is a method of a certain class whose name is composed of one or more symbols such that the parameters (called operands) are located on either side of the name.
An example is the addition (denoted +) and opposite (denoted -) operators.
We can distinguish several types of operators according to the number of operands:
- The unary operators which have only one operand which is positioned to the left or to the right of the name of the operator.
- Binary operators that have two operands separated by the name of the operator.
- Ternary operators whose name is divided into two parts to separate the operands.
But we will classify the operators according to their nature: