As you correctly indicate, group not a reserved keyword (language developers try not to introduce new reserved keywords by adding new functions to the language so as not to break existing programs). This is, however, a contextual keyword: it becomes a keyword in LINQ query expressions. Resharper suggests that you rename the variable in question in order to avoid the ambiguities that might arise if this variable were used in query expressions.
From the specification:
7.16.1 Ambiguity of query expressions
Query expressions contain several “contextual keywords,” that is, identifiers that have special meaning in this context. In particular, it is, from, where, on, equals, to, let, orderby, ascending, descending, select, group and. To avoid ambiguities in query expressions caused by the mixed use of these identifiers as keywords or simple names, these identifiers are considered keywords when they occur anywhere within the query expression. For this purpose, a query expression is any expression starting with "from identifier", followed by any token other than ";", "=" or ",".
If you try the following, you will get a compiler error:
var filteredParis = from pair in group.Pairs
Ani
source share