C# Assignment Operators

In this chapter you will learn:

  • What is C# Assignment Operators?
  • How many types of assignment operators in C sharp?
  • How to use assignment operator in program?

The C# assignment operator is generally suffix with arithmetic operators. The symbol of c sharp assignment operator is “=” without quotes. The assignment operator widely used with C# programming. Consider a simple example:


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

Various types of C# assignment operators are mentioned below:

Assignment Operators:

Assignment OperatorsUsageExamples
= (Equal to)result=5Assign the value 5 for result
+= (Plus Equal to)result+=5Same as result=result+5
-= (Minus Equal to)result-=5Same as result=result-5
*= (Multiply Equal to)result*=5Same as result=result*5
/= (Divide Equal to)result/=5Same as result=result/5
%= (Modulus Equal to)result%=5Same as result=result%5


Add = 15

Subtraction = 10

Multiplication = 50

Modulus = 0


In this chapter, you learned about different types of assignment operators in C#. You also learned how to use these assignment operators in a program. In next chapter, you will learn about Unary Operator in C#.

Leave a Reply

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