Operators in C#
Operators in C# Programming Language:
- is a valid combination of operators and operands, on evaluation it yields a result
Ex: 2 + 2, 10 – 2 etc.
- is a symbol which performs an operation on the given operand(s)
- is a value on which an operator performs an operation
Operators in any programming language are broadly categorized into
Unary Operators: accept only one operand.
Binary Operators: accept two operands.
Ternary Operators: accept three operands.
Types of C# Operators: LARA BICS
- C# provides rich set of operators to perform arithmetic, logical, comparison, etc.
L – Logical Operators : ( &&, || , ! )
A – Arithmetic Operators : ( +, -, *, /, % )
R – Relational Operators : ( <, >, <=, >=, ==, != )
A – Assignment Operators : ( = )
--Short Hand Assignment: ( +=, -=, *=, /=, %=,&=, |=, ^=, <<=, >>= , => etc. )
B – Bitwise Operators : (&, |, ~, ^ )
--Bitwise Shift: ( <<, >> )
I – Increment and Decrement Operators : (++ , --)
C – Conditional Operator : (?:)
S – Special Operators : ( sizeof , typeof, new, &, *, is, as, (type) etc.)