O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Associativity

If you look at the precedence of the multiplication and division operators in Table 7.1, you will find them to have equal precedence. Now, consider the following expression:

How does C# determine which operator is applied first? It cannot get any help from the precedence rules because the two operators have identical precedence. C# then resorts to the rules of associativity. An operator can either have left-to-right or right-to-left associativity. When two operators (such as (/) and (*)) with the same precedence can be applied to the same operand (such as 5 in the previous expression), left-to-right associativity will cause the leftmost ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required