ReSharper for Visual Studio Code 2026.1 Help

Code syntax style: bodies of type members

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, ReSharper lets you configure your preferences separately for different kinds of members and maintain the consistency of your preferences throughout your codebase.

ReSharper helps you enforce preferences for expression-bodied members in the existing code and takes your preferences into account when it produces new code with code completion and performs refactorings.

Enforce preferences for expression-bodied functions

ReSharper can help you check all simple members for compliance with your preferences and if they do not comply, it highlights such implementations and suggests the corresponding quick-fix. Default ReSharper's preferences say that the expression body is preferred for properties, indexers, and events:

ReSharper. 'To expression body' quick-fix

For all other kinds of members, suggestions are disabled by default. However, you can configure your preferences in a different way, so that, for example, ReSharper suggests converting expression-bodied methods to block bodies:

ReSharper. 'To statement body' quick-fix

Configure preferences for expression-bodied functions

You can configure syntax style settings via EditorConfig. These settings can be stored in .editorconfig files on different levels of your solution hierarchy. The files are normally put under VCS so that settings defined there are shared among the project team.

If you have used ReSharper for Visual Studio or JetBrains Rider on your computer, or have opened the current solution using these tools, ReSharper for Visual Studio Code will read and apply your syntax style settings from .DotSettings files. However, any settings configured via .editorconfig will take precedence.

Configure preferences for function body using EditorConfig

  1. Open the desired .editorconfig file.

  2. Add the required function body properties to the file. For example:

    method_or_operator_body = expression_body
03 March 2026