Operator
Arithmetic Operators
Used for mathematical calculations.
+ : Addition - : Subtraction * : Multiplication / : Division % : Modulus (remainder after division) ++ : Increment -- : Decrement
Relational (Comparison) Operators
Used to compare two values.
== : Equal to != : Not equal to > : Greater than < : Less than >= : Greater than or equal to <= : Less than or equal to
Logical Operators
Used to perform logical operations.
&& : Logical AND || : Logical OR ! : Logical NOT
Bitwise Operators
Used for manipulating data at the bit level.
& : Bitwise AND | : Bitwise OR ^ : Bitwise XOR (exclusive OR) ~ : Bitwise NOT (inversion) << : Left shift >> : Right shift
Assignment Operators
Used to assign values to variables.
= : Assignment += : Add and assign -= : Subtract and assign *= " Multiply and assign /= : Divide and assign %= : Modulus and assign &= : Bitwise AND and assign |= : Bitwise OR and assign ^= : Bitwise XOR and assign <<= : Left shift and assign >>= : Right shift and assign
Null-Coalescing Operators
Handle null values in expressions.
?? : Null-coalescing operator (returns the left operand if it's not null, otherwise the right) ??= : Null-coalescing assignment (assigns the right operand only if the left operand is null)
Conditional (Ternary) Operator
Used to return one of two values depending on a condition.
?: : Ternary operator (condition ? first_expression : second_expression)
Type Operators
Used for working with types and type casting.
is : Checks if an object is compatible with a given type as : Attempts to cast an object to a type, returns null if the cast fails typeof : Returns the Type of a class or struct sizeof : Returns the size in bytes of a value type checked : Enables overflow checking for arithmetic operations unchecked : Disables overflow checking for arithmetic operations
Index and Range Operators
[] : Access elements of an array or indexer ^ : Index from the end (C# 8.0+) .. : Range operator (C# 8.0+)
Lambda Operator
Used in lambda expressions.
=> : Lambda operator
Member Access and Object Operators
Used to access members of objects and handle null reference types.
. : Member access operator (e.g., object.Property) -> : Pointer-to-member access (unsafe context) ?. : Null-conditional operator (invokes a member only if the object isn't null) [] : Index access
Pointer Operators (Unsafe Code)
Used in unsafe contexts for working with pointers.
* : Dereference pointer & : Address-of operator (returns a pointer to the variable) -> : Pointer member access [] : Pointer index access
Other Special Operators
new : Creates objects and invokes constructors sizeof : Returns the size in bytes of a value type typeof : Returns the type of a class checked : Enables overflow checking for arithmetic operations unchecked : Disables overflow checking for arithmetic operations await : Pauses an async method until a task is complete yield : Returns values from an iterator method default : Returns the default value for a type nameof : Returns the name of a variable, type, or member as a string
Delegate and Event Operators
Used to work with delegates and events.
+= : Add a method to a delegate or event -= : Remove a method from a delegate or event