Primary Operators
member access.
|
|
null conditional member access. Returns null
if the left hand operand is null.
|
|
function invocation.
|
|
aggregate object indexing.
|
|
null conditional indexing. Returns null if the
left hand operand is null.
|
|
postfix increment. Returns the value of x and
then updates the storage location with the value of x that is one greater
(typically adds the integer 1).
|
|
postfix decrement. Returns the value of x and
then updates the storage location with the value of x that is one less
(typically subtracts the integer 1).
|
|
type instantiation.
|
|
returns the System.Type object representing
the operand.
|
|
enables overflow checking for integer
operations.
|
|
disables overflow checking for integer
operations. This is the default compiler behavior.
|
|
returns the default initialized value of type
T, null for reference types, zero for numeric types, and zero/null filled in
members for struct types.
|
|
declares and returns a delegate instance.
|
|
returns the size in bytes of the type operand.
|
|
pointer dereferencing combined with member
access.
|
Unary Operators
returns the value of x.
|
|
numeric negation.
|
|
logical negation.
|
|
bitwise complement.
|
|
prefix increment. Returns the value of x after
updating the storage location with the value of x that is one greater
(typically adds the integer 1).
|
|
prefix decrement. Returns the value of x after
updating the storage location with the value of x that is one less (typically
adds the integer 1).
|
|
type casting.
|
|
awaits a Task.
|
|
address of.
|
|
dereferencing.
|
Multiplicative Operators
multiplication.
|
|
division. If the operands are integers, the
result is an integer truncated toward zero (for example, -7 / 2 is -3).
|
|
modulus. If the operands are integers, this returns
the remainder of dividing x by y. If q = x / y and r = x % y, then x = q * y
+ r.
|
Addtive Operators
addition.
|
|
subtraction.
|
Shift Operators
shift bits left and fill with zero on the
right.
|
|
shift bits right. If the left operand is int
or long, then left bits are filled with the sign bit. If the left
operand is uint or ulong, then left bits are filled with zero.
|
Relational and Type-testing Operators
less than (true if x is less than y).
|
|
greater than (true if x is greater than y).
|
|
less than or equal to.
|
|
less than or equal to.
|
|
type compatibility. Returns true if the
evaluated left operand can be cast to the type specified in the right operand
(a static type).
|
|
type conversion. Returns the left operand cast
to the type specified by the right operand (a static type), but as
returns null where (T)x would throw an exception.
|
Equality Operators
equality. By default, for reference types
other than string, this returns reference equality (identity test).
However, types can overload ==, so if your intent is to test identity,
it is best to use the ReferenceEquals method on object.
|
|
not equal. See comment for ==. If a
type overloads ==, then it must overload !=.
|
Logical Operator
logical or bitwise AND. Use with integer types
and enum types is generally allowed.
|
|
logical or bitwise XOR. You can generally use
this with integer types and enum types.
|
|
logical or bitwise OR. Use with integer types
and enum types is generally allowed.
|
|
logical AND. If the first operand is false,
then C# does not evaluate the second operand.
|
|
logical OR. If the first operand is true, then
C# does not evaluate the second operand.
|
Null-coalescing Operator
returns x if it is non-null; otherwise, returns y.
|
Conditional Operator
if test t is true, then evaluate and return x;
otherwise, evaluate and return y.
|
Assignment and Lambda Operators
assignment.
|
|
increment. Add the value of y to the value of
x, store the result in x, and return the new value. If x designates an event,
then y must be an appropriate function that C# adds as an event handler.
|
|
decrement. Subtract the value of y from the
value of x, store the result in x, and return the new value. If x designates
an event, then y must be an appropriate function that C# removes as an
event handler
|
|
multiplication assignment. Multiply the value
of y to the value of x, store the result in x, and return the new value.
|
|
division assignment. Divide the value of x by
the value of y, store the result in x, and return the new value.
|
|
modulus assignment. Divide the value of x by
the value of y, store the remainder in x, and return the new value.
|
|
AND assignment. AND the value of y with the
value of x, store the result in x, and return the new value.
|
|
OR assignment. OR the value of y with the value
of x, store the result in x, and return the new value.
|
|
XOR assignment. XOR the value of y with the
value of x, store the result in x, and return the new value.
|
|
left-shift assignment. Shift the value of x
left by y places, store the result in x, and return the new value.
|
|
right-shift assignment. Shift the value of x
right by y places, store the result in x, and return the new value.
|
|
lambda declaration.
|
Brak komentarzy:
Prześlij komentarz