Auto generate function documentation in Visual Studio

后端 未结 8 1845
醉梦人生
醉梦人生 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 02:10

    GhostDoc!

    Right-click on the function, select "Document this" and

    private bool FindTheFoo(int numberOfFoos)
    

    becomes

    /// 
    /// Finds the foo.
    /// 
    /// The number of foos.
    /// 
    private bool FindTheFoo(int numberOfFoos)
    

    (yes, it is all autogenerated).

    It has support for C#, VB.NET and C/C++. It is per default mapped to Ctrl+Shift+D.

    Remember: you should add information beyond the method signature to the documentation. Don't just stop with the autogenerated documentation. The value of a tool like this is that it automatically generates the documentation that can be extracted from the method signature, so any information you add should be new information.

    That being said, I personally prefer when methods are totally selfdocumenting, but sometimes you will have coding-standards that mandate outside documentation, and then a tool like this will save you a lot of braindead typing.

提交回复
热议问题