With ReSharper, you can quickly delegate execution to members provided by fields or properties - in other words, publish the whole interface of a field or property, or a part of it, through containing type interface.
You can set up common code generation options in the ReSharper | Options | Code Editing | Members Generation.
- In the editor, position the caret within a type where you would like to generate delegating members.
- On the main menu, choose ReSharper | Edit | Generate Code, or press Alt+Insert.
- In the Generate pop-up menu, select Delegating members.
Generate dialog box that appears,
you will see a list of private properties and fields in the current type,
and members of types that they belong to. Select some or all of these type members, and
generate wrappers in the current type that delegate execution to selected type members.
Finish to complete the wizard. For example,
if the set of members shown above is selected, ReSharper generates the following wrappers:
To bind any code generation command to its own shortcut, go to Tools | Options | Environment | Keyboard and look for commands starting with ReSharper_Generate.
This feature is supported in the following languages/technologies:
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see the corresponding topics in the ReSharper by Language section.
- Generating Type Constructors
- Generating Properties
- Implementing/Overriding Members
- Generating Partial Methods
- Generating Equality Members
- Generating Equality Comparer
- Generating Formatting Members