By default, JetBrains Rider automatically detects C# version based on the associated compiler. However, you can specify the target C# version explicitly for a project — press on the project in the Solution Explorer and use the Language version selector on the Application page of the Project Properties dialog .
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.
Starting from C# 6.0, you can declare type members using expression bodies, which look very similar to lambda expressions. You can use expression-bodied methods and properties to further simplify the syntax of simple implementations.
If you prefer to stick to either expression-bodied or block-bodied implementations for simple members, JetBrains Rider lets you configure your preferences separately for different kinds of members and maintain the consistency of your preferences throughout your codebase.
For example, let's select Expression body as the preferred style for properties, indexers, and events. Accordingly, JetBrains Rider suggests the quick-fix To expression body if a simple property accessor is written with a block body:
Suboptimal code
publicstring Name
{
get{return _name ??"Default name";}
set{ _name =value;}
}
After the quick-fix
publicstring Name
{
get=> _name ??"Default name";
set=> _name =value;
}
tip
Reverse transformation is available with a context action.