a) Both dot operator ( a.x ) and index operator ( a[x] ) have the same level of precedence. So based on what precedence rules is an expression a[x].SomeMember evaluated as (a[x]).SomeMember and not as (a.SomeMember )[x]?
b) Is casting operator an unary operator ( and thus has lower precedence than dot operator ) and for that reason is an expression (int)a.xevaluated as (int)(a.x)?
thank you
For a)
From C# Specification, section 7.2.1:
This means that the operators will get precedence, in this situation, from left to right.
b) Yes, this is correct. This is a Cast Expression, described in section 7.6.6, which is applied to a unary expression, and casts are categorized with the Unary operators (Section 7.6) and treated with the same precedence.