ReSharper 2016.3 Help

Code Generation

ReSharper provides a variety of ways to generate boilerplate code. For example, you can use undeclared code symbols and automatically generate these symbols based on usages, generate type members, and more.

If the design-time code inspection is enabled in the current file, ReSharper detects missing members and suggests the corresponding quick-fixes for implementing missing members:

Code Generation command in the action list

A lot of ways to generate code is also provided with Context Actions and Code Templates.

In this section:

You can control how new code is generated in two major ways:

  • Configure various aspects of code style (e.g. naming style, formatting rules, etc.) ReSharper will enforce its requirements when generating code.
  • For generating type members, you can choose default body content for generated members. One of the three options - NotImplementedException(), returning default value, and non-compilable code - can be selected on the Code Editing | Members Generation page of ReSharper options.

Most of ReSharper's code generation features are available in C# and Visual Basic.NET, some are available in several languages, others are language-specific. The table below lists all code generation features and languages/technologies where they are supported.

The instructions and examples given in the topics within this section address the use of code generation features in C#. For more information on code generation features available for specific languages, see the corresponding topics in the ReSharper by Language section.

Last modified: 12 October 2017

See Also