8.8. Assignment Operators

C# and Java share a common set of assignment operators, which are explained in the following sections.

8.8.1. The = Operator

This binary operator stores the value of the operand on the RHS in the indexer, property, or variable defined on the LHS. For this assignment to be successful, either the two operands should be of the same data type or the LHS operand should have an implicit conversion to the RHS operand. This operator cannot be overloaded.

8.8.2. The += Operator

The addition assignment operator is a binary operator that increments the operand on the LHS by an amount indicated by the operand on the RHS and then assigns the result to the LHS. This operator cannot be overloaded.

x += y implies x = x + y

8.8.3. The ...

Get .NET for Java Developers: Migrating to C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.