first, it’s not a duplication of
What does the @ symbol before a variable name mean in C#?
as group is not a preserved keyword.
I wrote some code and the resharper suggested me to add @ before the variable group.
Any idea why?
var group = GetDefaultGroup(ClientServiceCommon.Poco.Group);
filteredPairs = @group.Pairs.ToList();
As you correctly point out,
groupis not a reserved keyword (the language designers try hard not to introduce new reserved keywords when they add new features to the language in order to not break existing programs).It is, however, a contextual keyword: it becomes a keyword within LINQ query expressions. Resharper is suggesting you rename the variable in question to avoid ambiguities that would result if this variable were used within query expressions.
From the language specification:
If you tried to do the following, you would get a compiler error: