Refactoring/renaming within comments in Visual C# Express
When refactor->renaming MyMethod in the following example in Visual C# 2010 Express, the method name 'MyMethod' in the comment won't be changed.
Usually that a comment isn't touched by refactor/rename is for good reasons, since how should the IDE know that it's not just some word but actually references the very method that it is refactoring.
So is there a way in whi开发者_如何学Goch a word in a comment can be bound to a class/method/variable name within Visual C# 2010 Express, so that it's changed as well during refactoring/renaming?
If there are several ways what would be the easiest/cheapest way? (cheapest - in case of plugins or commercial versions)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
/// text for class MyClass
public class MyClass
{
/// <summary><c>MyMethod</c> is a method in the <c>MyClass</c> class.
/// </summary>
public static void MyMethod(int Int1)
{
}
/// text for Main
public static void Main()
{
Console.ReadLine();
}
}
}
At least in the commercial editions, the rename dialog (press F2) has an Search in Comments
checkbox.
Not Sure about the Express edition, but VS 2008 professional edition we can do it:
- http://www.thereforesystems.com/refactoring-in-visual-studio-2008/
According to wikipedia, the Renaming refactoring mentioned in other answers should be available in the Express edition. So try Ctrl-R-R, F2 or right-click/Refactor/Rename.
精彩评论