As new versions of C# come out, it’s only natural to want to update your code to take advantage of the latest syntactic features. Luckily, ReSharper is there to help you update your code automatically.
tip
By default, ReSharper automatically detects C# version based on the associated compiler. However, you can specify the target C# version explicitly for a project — right-click the project in the Solution Explorer, choose Edit project item properties from the context menu and use the C# Language Level selector .
To set the C# version for all projects in your solution, specify it in a Directory.Build.props file in your solution directory as described here.
Let's take as an example one of the C# 6.0's best loved features - conditional access expressions. First thing to note is that ReSharper gently points at possibilities to use new language features right in the editor:
As usual, pressing Alt+Enter on the highlighted code brings up a quick-fix that helps you make use of the new language feature:
After applying the fix, the method is transformed as follows: