Video is ready, Click Here to View ×


Operators in C# includes :
Assignment Operator =
Arithmetic Operator like +, -, *, /, %,++, —
Relational Operators ==, !=, less than, greater than, less than or equals, greater than or equals,
Logical Operators &, |, ^, !
Short-Circuit Logical Operators &&, ||
Conditional Operator or Ternary Operator ?:

Ternary Operators
The ? operator is often used to replace certain types of if-then-else constructions.
The ? is called a ternary operator because it requires three operands.
The general form : Exp1 ? Exp2 : Exp3;
where Exp1 is a bool expression, and Exp2 and Exp3 are expressions.
The value of ? expression is determined like this:
Exp1 is evaluated. If it is true, then Exp2 is evaluated and becomes the value of the entire ? expression
If Exp1 is false, then Exp3 is evaluated, and its value becomes the value of the expression.