Assignment operator

Assignment operator

The Assignment operator is the single equal sign =.it has this general form

Var=expression;

Here the type of the var is must compatible with the type of expression.assignment operator has one most important attribute that it allows us to create a chain of assignments. For example

Int x, y, z;

x = y = z=100;

This fragment sets the variables x, y and z to 100 using single statement. This worksbecause the = is an operator that yields the value of the right hand expression. thus, the value of z =100 is 100, which is then assigned to y, which in turn is assigned to x.using a chain of assignment is an easy way to set a group of variables to a common value.

Next Recommended Reading Null Conditional Operator In C#