This documentation is archived and is not being maintained.

Operators Compared in Various Languages

This topic lists the operators for Visual Basic, C++, C#, and F#.

For details about operators in this language

See

Visual Basic

Operators Summary

C++

C++ Operators

User-Defined Operators

C#

C# Operators

F#

Symbol and Operator Reference (F#)

 

Visual Basic

C++

C#

F#

Additive

 

 

 

 

  Addition

+

+

+

+

  Subtraction

-

-

-

-

Multiplicative

 

 

 

 

  Multiplication

*

*

*

*

  Division

/

/

/

/

  Integer division

\

/1

/1

/

  Modulus division (returning only the remainder)

Mod (also works with floating point)

%

%

%

  Exponentiation

^

Not applicable

Not applicable

**

Assignment

 

 

 

 

  Assignment

=

=

=

=

  Addition

+=

+=

+=

Not applicable

  Subtraction

-=

-=

-=

Not applicable

  Multiplication

*=

*=

*=

Not applicable

  Division

/=

/=

/=

Not applicable

  Integer division

\=

Not applicable

/=1

Not applicable

  Exponentiation

^=

Not applicable

Not applicable

Not applicable

  String concatenation

&=

+=

+=

Not applicable

  Modulus division

Not applicable

%=

%=

Not applicable

  Left shift

<<=

<<=

<<=

Not applicable

  Right shift

>>=

>>=

>>=

Not applicable

  Bitwise AND

Not applicable

&=

&=

Not applicable

  Bitwise exclusive OR

Not applicable

^=

^=

Not applicable

  Bitwise inclusive OR

Not applicable

|=

|=

Not applicable

Relational and equality

 

 

 

 

  Less than

<

<

<

<

  Less than or equal to

<=

<=

<=

<=

  Greater than

>

>

>

>

  Greater than or equal to

>=

>=

>=

>=

  Equal

=

==

==

=

  Not equal

<>

!=

!=

<>

  Reference variable comparison

Is

IsNot

Not applicable

==

=

  Reference type comparison

TypeOf x Is Class1

Not applicable

x is Class1 (also see as and typeof)

:?

  String comparison

=

Equals

(There are functions to compare and concatenate strings)

==

Equals

=

  String concatenation

&

Not applicable

+

+

  Short circuited Boolean AND

AndAlso

&&

&&

&&

  Short circuited Boolean OR

OrElse

||

||

||

Bit shift

 

 

 

 

  Left shift

<<

<<

<<

<<<

  Right shift

>>

>>

>>

>>>

Scope resolution

 

 

 

 

  Scope resolution

.

MyBase

MyClass

::

.

base

.

base

Postfix2

 

 

 

 

  Array element

( )

[ ]

[ ]

[| |]

  Function call

( )

( )

( )

( )

  Type cast or conversion

CInt

CDbl

...

CType

(type)

(type)

:>

:?>

  Member selection

.

!

.

->

.

.

  Postfix increment

Not applicable

++

++

Not applicable

  Postfix decrement

Not applicable

--

--

Not applicable

Unary3

 

 

 

 

  Indirection

Not applicable

*

* (unsafe mode only)

! (for reference cells)

  Address of

AddressOf

&

& (unsafe mode only; also see fixed)

&

  Logical NOT

Not

!

!

not

  One's complement

Not

~

~

~~~

  Prefix increment

Not applicable

++

++

Not applicable

  Prefix decrement

Not applicable

--

--

Not applicable

  Size of type

Not applicable

sizeof

sizeof

sizeof

  Comma

Not applicable

,

Not applicable

Not applicable

Bitwise

 

 

 

 

  Bitwise AND

And

&

&

&&&

  Bitwise exclusive OR

Xor

^

^

^^^

  Bitwise inclusive OR

Or

|

|

|||

Logical

 

 

 

 

  Logical AND

And

&

&

&&

  Logical OR

Or

|

|

||

Conditional

 

 

 

 

  Null coalescing

If( )

Not applicable

??

Not applicable

  Ternary conditional

If( )

?:

?:

Not applicable

Pointer to member

 

 

 

 

  Pointer to member

Not applicable

.* ->

. (Unsafe mode only)

Not applicable

Reference

 

 

 

 

  Reference

Not applicable

&

Not applicable (use reference types)

ref

1 The division operator is overloaded to handle both integer and floating-point division, depending on the operands.

2 Postfix operators have the highest order of precedence in expression evaluation.

3 Unary operators appear before the operand and associate from right to left.

Show: