I was wondering if there is a way (hopefully keyboard shortcut) to create auto generate function headers in visual studio.
Example:
Private Function Foo(ByVal param1 As String, ByVal param2 As Integer)
And it would automagically become something like this...
'---------------------------------- 'Pre: 'Post: 'Author: 'Date: 'Param1 (String): 'Param2 (Integer): 'Summary: Private Function Foo(ByVal param1 As String, ByVal param2 As Integer)
You can generate the XML documentation file using either the command-line compiler or through the Visual Studio interface. If you are compiling with the command-line compiler, use options /doc or /doc+. That will generate an XML file by the same name and in the same path as the assembly.
Type in /// before your method, property, etc. VS will generate the comment blocks automatically. Pedantism: Visual Studio will automatically generate these comment blocks.
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.
GhostDoc!
Right-click on the function, select "Document this" and
private bool FindTheFoo(int numberOfFoos)
becomes
/// <summary> /// Finds the foo. /// </summary> /// <param name="numberOfFoos">The number of foos.</param> /// <returns></returns> 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With