Can I generate class and method summaries with ReSharper

穿精又带淫゛_ 提交于 2019-12-23 02:43:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!