public void Method2() { // 4b. 将光标放在类型名或者方法名上 // 关闭 RenameInAnotherFile.cs 这个文件 // 执行Rename // 取消勾选 "To enable undo, open all files with changes for editing" // 重命名后, 有另一个文件标记为已修改, 但是没有被打开 // 执行 Ctrl+Z 可以撤销当前文件的修改, 并产生了一个编译错误, 执行重做(Ctrl+Y) // 再次执行重命名操作复原成原来的名字 RenameInAnotherAnotherFile.StaticMethod(); }
public void Method2() { // 4b. Place text caret on type name or method name // Make sure RenameInAnotherFile.cs is closed // Invoke rename refactoring // On first page, UNCHECK "To enable undo, open all files with changes for editing" // Rename symbol // The other file is not opened, but modified // Ctrl+Z will undo the local change, but produce uncompilable code // Redo the local change (Ctrl+Y) // Perform rename refactoring back to original name RenameInAnotherAnotherFile.StaticMethod(); }