Auto generate function documentation in Visual Studio

后端 未结 8 1821
醉梦人生
醉梦人生 2020-12-13 01:43

I was wondering if there is a way (hopefully keyboard shortcut) to create auto generate function headers in visual studio.

Example:

Private Function          


        
相关标签:
8条回答
  • 2020-12-13 01:49

    You can use code snippets to insert any lines you want.

    Also, if you type three single quotation marks (''') on the line above the function header, it will insert the XML header template that you can then fill out.

    These XML comments can be interpreted by documentation software, and they are included in the build output as an assembly.xml file. If you keep that XML file with the DLL and reference that DLL in another project, those comments become available in intellisense.

    0 讨论(0)
  • 2020-12-13 01:53
    ///
    

    is the shortcut for getting the Method Description comment block. But make sure you have written the function name and signature before adding it. First write the Function name and signature.

    Then above the function name just type ///

    and you will get it automatically

    0 讨论(0)
  • 2020-12-13 01:54

    In visual basic, if you create your function/sub first, then on the line above it, you type ' three times, it will auto-generate the relevant xml for documentation. This also shows up when you mouseover in intellisense, and when you are making use of the function.

    0 讨论(0)
  • 2020-12-13 01:55

    Normally, Visual Studio creates it automatically if you add three single comment-markers above the thing you like to comment (method, class).

    In C# this would be ///.

    If Visual Studio doesn't do this, you can enable it in

    Options->Text Editor->C#->Advanced

    and check

    Generate XML documentation comments for ///

    0 讨论(0)
  • 2020-12-13 02:06

    I'm working on an open-source project called Todoc which analyzes words to produce proper documentation output automatically when saving a file. It respects existing comments and is really fast and fluid.

    http://todoc.codeplex.com/

    0 讨论(0)
  • 2020-12-13 02:06

    Make that "three single comment-markers"

    In C# it's ///

    which as default spits out:

    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    

    Here's some tips on editing VS templates.

    0 讨论(0)
提交回复
热议问题