Unary

  • Updated
Operator Compatible types Description
++

Integer,

Decimal

When prefixing a numeric expression, increments the expression value by 1 and returns the incremented value:

 

var x = 1;

var y = ++x; // x == 2, y == 2

 

When following a numeric expression, increments the expression value by 1 but returns the prior (un-incremented)

value:

 

var x = 1;

var y = x++; // x == 2, y == 1

--

Integer,

Decimal

When prefixing a numeric expression, decrements the expression value by 1 and returns the decremented value:

 

var x = 1;

var y = --x; // x == 0, y == 0

 

When following a numeric expression, decrements the expression value by 1 but returns the prior (un- decremented) value:

 

var x = 1;

var y = x--; // x == 0, y == 1
typeof All

Returns the CLR System.Type instance that corresponds to the operand:

 

var x = 1.1;

var y = typeof( x );

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.