CSharp Operators

C# provides a large set of operators, which are symbols that specify which operations to perform in an expression. Operations on integral types such as ==, !=, <, >, <=, >=, binary +, binary -, ^, &, |, ~, ++, --, and sizeof() are generally allowed on enumerations. In addition, many operators can be overloaded by the user, thus changing their meaning when applied to a user-defined type.

Operators

Operator category

x.y
x?.y
x?[y]
f(x)
a[i]
x++
x--
new
typeof
checked
unchecked
default
nameof
delegate
sizeof
stackalloc
x->y

Primary

+x
-x
!x
~x
++x
--x
^x
(T)x
await
&x
*x
true and false

Unary

x..y

Range

x * y
x / y
x % y

Multiplicative
x + y
x – y
Additive

x << y
x >> y

Shift

x < y
x > y
x <= y
x >= y
is
as

Relational and type-testing

x == y
x != y

Equality
x & y

Boolean logical AND or bitwise logical AND

x ^ y

Boolean logical XOR or bitwise logical XOR

x | y

Boolean logical OR or bitwise logical OR

x && y

Conditional AND

x || y

Conditional OR

x ?? y

Null-coalescing operator

c ? t : f

Conditional operator

x = y
x += y
x -= y
x *= y
x /= y
x %= y
x &= y
x |= y
x ^= y
x <<= y
x >>= y
x ??= y
=>

Assignment and lambda declaration

 C# Operators Visual Studio: source from microsoft.com