Add Similar Member
Refactoring with
Add Similar Member is a convenient way to create a new method or member variable that is similar to an existing member. The refactoring is available from any reference to a member.
Hover over a reference and select
Add Similar Member from the refactoring menu.
A dialog opens containing the signature of the existing method or member variable. Make the desired changes to the member name and parameter list, if applicable.
The new member is added to the class containing the original member.
Navigate after Add Similar Member
Use the
Navigate commands to jump between the new member and your original location. Alt+Left returns you to your original position; Alt+Right returns you to the new member.
Miscellaneous
Add Similar Member creates a new member in the class containing the member over which you hovered. If you hover over a member from a base class, the new member is created in the base class, i.e. not the current class.
Invoking
Add Similar Member on a method creates a stub; the body of the original method is not copied.
For C/C++, new methods are added to headers only, i.e. created inline. Follow
Add Similar Member with
Move Implementation to Source File if you want the new method in a source file.
Add Similar Member is not available on classes found using
stable directories.
Add Similar Member is also available from the context menu in
VA Outline.
Use UNDO to revert changes made by
Add Similar Member. (One UNDO reverts all changes when using VS2005 or VS.NET. Multiple UNDOs required when using VC++ 6.0.)