C# Operator

Last modified: July 11, 2021
Arithmetic Operators
Operator Name Description Example
+ Addition Add two values a+ b
- Subtraction Subtracts one value from another a-b
* Multiplication Multiply two values a * b
/ Division Divide one value from another a/b
% Modulus Divison remainder a % b
++ Increment Increment a value by 1 x++
-- Decrement Decrement a value by 1 x--
Comparison Operators
Operator Name Example
== Equal to a==b
!= Not equal a!=b
> Greater than a>b
< Less than a<b
>= Greater than or equal to a>=b
<= Less than or equal to a<=b
Logical Operators
Operator Name Description Example
&& Logical And Both must be true to return true a<5 && b > 10
|| Logical Or Only one can be true to return true a<5 || b > 10
! Logical Not Reverse the result !(a<5 && b > 10)