Operators

There are a large number of operators in C#.
link - learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/


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

.NET Library > Framework 3.5 > Lambda Expressions




© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext