Show/Hide Toolbars

XSharp

X# uses the following unary operators:

 

Operator

Example

Meaning

+

+x

returns the value of x.

-

-x

numeric negation.

++ (prefix)

++x

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)

--x

prefix decrement. Returns the value of x after updating the storage location with the value of x that is one greater (typically adds the integer 1).

~

~x

bitwise complement

++ (postfix)

x++

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)

x--

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).

 

Note that shift operators are only supported on integral numeric types