Generating Delegating Members
Alt+Insert |
Delegating Members
ReSharper_GenerateDelegating
With ReSharper, you can quickly generate members that delegate execution to public members (methods and properties) available through private fields and properties - in other words, publish the desired part of the interface of any private field or property in the containing type.
In the example below, this command is used to generate delegating members for the
_center
field:
To generate delegating members
- In the editor, position the caret within a type where you would like to generate delegating members.
- Press Alt+Insert or choose in the main menu .
- In the Generate pop-up menu, select Delegating Members.
-
In the
Generate
dialog that appears,
you will see a list of private properties and fields in the current type.
You can expand these items to see the members of their types.
Select some or all of these type members, and ReSharper will
generate wrappers in the current type that delegate execution to selected type members.
-
Click
Finish
to complete the wizard.
You can also click Options to review or modify common code generation preferences on the page of ReSharper options.
This feature is supported in the following languages/technologies:
C# | VB.NET | C++ | HTML | ASPX | Razor | JavaScript | TypeScript | CSS | XML | XAML | RESX | Build Scripts | Protobuf | JSON |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.