问题
I need a convenient way to generate stub of class or method summary in C#. Like this sample summary:
public class TestClass
{
/// <summary>DoWork is a method in the TestClass class.
/// <para>Here's how you could make a second paragraph in a description. <see cref="System.Console.WriteLine(System.String)"/> for information about output statements.</para>
/// <seealso cref="TestClass.Main"/>
/// </summary>
public static void DoWork(int Int1)
I wasn't able to find such feature out of the box in ReSharper. I assume it's refactoring functions would have it but they don't seem to advertise it.
Perhaps because Visual Studio out of the box has a shortcut to generate it? Is there? What is the convenient way to have the summary added to the class or method?
回答1:
If you have set your project to generate XML documentation, R# will offer the option to generate XML comments for public members.
If you want something that infers textual documentation right from class and method names, then GhostDoc is your thing.
If you want to generate the same structure for each method, simply define a corresponding Live Template or VS snippet.
回答2:
This is an older question, but an alternative to the accepted answer may be helpful to some.
Add the Resharper Stylecop extension to visual studio.
Once installed, you will have the opportunity to configure the xml documentation settings. Be sure to enable "Create XML doc stubs"
Once configured, run the Resharper code cleanup and select the Stylecop Option.
来源:https://stackoverflow.com/questions/27725866/can-i-generate-class-and-method-summaries-with-resharper