ReSharper provides two related code generation features:
- Implement missing members implements any interface members or abstract members missing from the current class.
- Override members does the same as Implement missing members, but it also overrides virtual members if applicable.
To implement and/or override members
- Position the caret within a class where you'd like to implement and/or override members.
- On the main menu, choose ReSharper | Edit | Generate Code, or press Alt+Insert.
- From the Generate pop-up menu, select Implement missing members or Overriding members.
There's an alternative way to open the Implement missing members page of the Generate wizard: position the caret over the declaration of the class where members must be implemented, click Alt+Enter and select the Implement members quick-fix from the list:
Tip
- On the Override members or Implement missing members page of the Generate wizard, select members to implement and/or override:
The Implement missing members page differs from Override members (shown above) in two ways:
Note
- It doesn't show overridable members (such as members of the
Objectclass in this case). - It doesn't emphasize must-implement members with bold.
- It doesn't show overridable members (such as members of the
- Optionally, use the following controls that are applied to all implemented/overridden members at this point (see next step
for guidelines on configuring individual members):
- Wrap in regions groups overridden and implemented members within regions called Overrides of [name of base class] and Implementation of [name of base interface].
- Implement as lets you choose whether to implement members as:
- Public members.
- Public virtual members.
- Exlicitly implement them as private members.
- Properties as lets you choose whether to implement properties as:
- Traditional properties with
NotImplementedExceptions in accessor bodies. - Traditional properties that access private fields.
- Automatic properties.
- Traditional properties with
- Copy XML documentation copies XML documentation from base members to overridden/implemented members.
- Do one of the following:
- To configure generation options (listed in the previous step) individually for specific members, click Advanced. You can then select individual members, or Ctrl-click two or more members to configure their settings in a uniform fashion. After finishing this step, click Next, and as soon as the following screen appears, click Finish.
- Click Finish to complete the wizard right away.
