In visual studio, there is a feature that lets you do the following:
- Right-click on your method/class/property
- Refactor > Rename
Doing this will make the change consistent across all the projects in the current solution.
I was wondering if there is any API method on the DTE or such classes that one can use to perform this action using a custom code. So this is something that I am looking for
var myCodeElement = selectMyMethod();
myCodeElement.rename("myNewName");
//or
RefactorEngine.ren开发者_如何学Goame(myCodeElement, "myNewName");
Thanks for your time.
CodeElement2.RenameSymbol. This affects whichever code element you call it against (so you will need to use the FileCodeModel to specify the desired element, but it sounds like you're already on top of that), and allows you to specify the new name.
精彩评论