Operators

There are a large number of operators in C#.


OperatorC#VB.Net
Compare object reference typex is Class1 TypeOf x Is Class1
Assignment==
Concatenation+&
Concatenation Self Assignment+=&=
   
Equality==Is
Equality - Not equal!=<>
   
Logical AND&And
Logical AND Self Assignment&= 
Logical AND Conditional&&AndAlso
Logical OR|Or
Logical OR Self Assignment|= 
Logical OR Conditional||OrElse
Logical OR Exclusive^Xor
Logical OR Exclusive Self Assignment^= 
Logical NOT~Not
Logical NOT / unary ??!Not
   
Division (integer)/ (depending on the operands)\ ??
Division Assignment (integer)/= (depending on the operands)\= ?? They are opposite directions ??
Multiplication**
Multiplication Self Assignment*=*=
Subtraction--
Subtraction Self Assignment-=-=
Addition++
Addition Self Assignment+=+=
Modulus%%
Modulus (division returning only the remainder)% (eg 10 % 5)Mod (eg 10 Mod 5)
Modulus Self Assignment%= 
Exponentiationn/a^
   
Bitwise AND&= 
Bitwise OR  
Address of& (unsafe mode only)AddressOf
Type cast(type)Cint, CDbl, , CType
Pointer to member. (Unsafe mode only) 
Scope resolution., base.
Conditional?: (right to left)IIf
One's complement / unary ??~Not
Indirection* (unsafe mode only) 
unary plus+ 
Postfix increment++ 
Postfix decrement  
Left Shift<< 
Left Shift Self Assignment<<= 
Right Shift>> 
Right Shift Self Assignment>>= 
Size of typesizeof 



Primary



Unary


++variable 
--variable



Multiplication


value1 * value2 
value1 / value2
value1 % value2



Addition


value1 + value2 
value1 - value2



Shift



Relational and Type Testing



Assignment



Lambda

Framework > Framework 3.5 > Lambda Expressions




© 2017 Better Solutions Limited. All Rights Reserved. © 2017 Better Solutions Limited

PrevNext