JetBrains Rider
 
2024.2
Get JetBrains Rider
You are viewing the documentation for an earlier version of JetBrains Rider.

Generate Type Constructors

Last modified: 26 May 2024

The constructor generation wizard creates a non-default constructor that takes parameters for selected fields , properties and auto-properties.

All generated constructors follow the same pattern where:

  • Each field , property, or auto-property included in the constructor is initialized with a parameter.

  • The name of the parameter is derived from the name of the corresponding field or property.

If there are non-default base type constructors, the required parameters are added to the generated constructor and passed to the base class constructor.

In the example below, this command is used to generate a new Circle constructor that takes two additional parameters to initialize _radius and _center fields.