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 |
Primary |
+x |
Unary |
x..y |
Range |
x * y |
Multiplicative |
x + y x – y |
Additive |
x << y |
Shift |
x < y |
Relational and type-testing |
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 |
Assignment and lambda declaration |
C# Operators Visual Studio: source from microsoft.com
Previous page: C# OpenFileDialog
Next page: PHP, AJAX UPLOAD scripts and tutorials