ReSharper 2017.1 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.

C# VB.NET C++ HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts Protobuf JSON
Generate Code from Usage Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is not available Feature is available Feature is not available Feature is available Feature is not available Feature is not available
Generating Code with Code Completion Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Constructors Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Properties/(Getters and Setters) Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Implementing/Overriding Members Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Delegating Members Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Dispose Pattern Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Partial Methods Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Hash Function Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Equality Members Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Relational Members Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Equality Comparer Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Relational Comparer Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Formatting Members Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Event Subscriptions Feature is not available Feature is available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Definitions Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Copy and move operations Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Relational operations Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Stream output operator Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Swap function Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available
Generate Content for Placeholders Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available

See Also

Last modified: 4 July 2017