Reputation: 7388
For methodA(), I want to use the /// xml documentation system. I want to document that methodB() should be called before methodA().
Supposing someone renamed methodB() to renamedMethodB(), I want the old methodB() reference in the comments to be updated to renamedMethodB(). Supposing someone deleted methodB() (and assuming nothing else used methodB()), I want the program to not compile, or at least generate a warning on account of the methodB() comment then referring to a method that doesn't exist anymore.
I'm sure I saw an example of this someplace, so I think its possible. How do I do it?
Upvotes: 3
Views: 211
Reputation: 37700
If the user use the refactoring menu of Visual Studio, he will have the option to search in strings and comments the method. If he doesn't, there is no option to do this automatically.
To reduce the risk of missing renaming, always use the <see cref="OtherMethod"/>
construct in your comments. If the method name can't be resolved, a warning will be produced.
Example :
/// <summary>
/// This method will call <see cref="MethodB"/>
/// </summary>
public void MethodA()
{
MethodBNew();
}
/// <summary>
/// Some method
/// </summary>
public void MethodBNew() // Formerly MethodB
{
}
This code will produce a warning.
PS: I assume the Build Xml documentation option is activated in the project properties, but I'm confident it is if you have asked such question.
Upvotes: 5