To generate a constructor
  1. Position the caret within a class where you'd like to generate a constructor.
  2. On the main menu, choose ReSharper | Edit | Generate Code, or press Alt+Insert.
  3. From the Generate pop-up menu, select Constructor.
  4. On the Generate constructors page of the Generate wizard, select type members that should be initialized in the new constructor. Optionally, select one or several base class constructors. For every selected base constructor, a new constructor will be generated that will call the base and additionally initialize selected members.
    Generate Constructors
    Image 1:
  5. Optionally, use the following controls:
    • Access Rights defines common access rights for all constructors that the wizard generates.
    • Copy XML documentation copies XML documentation from all base constructors.
  6. Do one of the following:
    • To configure XML documentation options individually for specific constructors, click Advanced. After finishing this step, click Next.
    • Otherwise, click Finish to complete the wizard. For example, if a single base constructor and a single class member is selected, as shown above, ReSharper generates the following constructor:
      Generate Constructors
      Image 2:
       Note that the name of generated constructor parameter classDeclaration differs from the name of property myClassDeclaration. This is accomplished by specifying my as the default prefix for instance fields in Languages | Common | Naming Style tab in the ReSharper Options dialog box. This forces ReSharper to drop the prefix when generating parameters based on instance fields. Were the prefix not specified, ReSharper would generate the parameter with the same name as the initialized field, and used this. qualifier in the initializing expression:
    this.myClassDeclaration = myClassDeclaration;