The C# assignment operator is usually suffix with arithmetic operators. The symbol of c sharp assignment operator is “=” while not quotes. The assignment operator wide used with C# programming. think about a simple example:

result=n1+n2;

In this example, the equal to (=) assignment operator assigns the value of n1 + n2 into result variable.

Various varieties of C# assignment operators are mentioned below

ASSIGNMENT OPERATORS:

Assignment Operators Usage Examples
= (Equal to) result=10 Assign the value 10 for result
+= (Plus Equal to) result+=10 Same as result=result+10
-= (Minus Equal to) result-=10 Same as result=result-10
*= (Multiply Equal to) result*=10 Same as result=result*10
/= (Divide Equal to) result/=10 Same as result=result/10
%= (Modulus Equal to) result%=10 Same as result=result%10

Leave a Reply

Your email address will not be published. Required fields are marked *