.NET Discussion

.NET Issues, Problems, Code Samples, and Fixes

Visual Studio/VB.NET: How To Easily Document Your Code

If you’re a routine Visual Studio user like me, I don’t need to tell you how awesome Intellisense is. Not only would some of us be lost without it, but it also helps us be way more efficient programmers either through simple selection of methods or properties or by discovering new object members that maybe we didn’t know about previously. Additionally, one of the main benefits of Intellisense is that it tells you  about the item in question, for instance, that the String.IsNullOrEmpty() function “Indicates whether the specified System.String object is null or an System.String.Empty string.”

Visual Studio Intellisense

When writing my own objects, however, I used to find myself yearning for this kind of help for my own functions. Wouldn’t it be great to get Intellisense to tell me what that “GetUserInfo” function I wrote five weeks ago does rather than me having to go look it up? What about what those parameter names mean? Luckily, there is a way, and it is super easy.

For example, let’s say you have an object that returns its own permalink in a shared function called GetHTMLPermaLink(). To document it, simply place your cursor above the function and press the apostrophe key three times: '''. Automagically, the following pops up:

Function Documentation

All you have to do is fill in the blanks and viola, you have documented code! (NOTE: in C#, I believe the syntax is /// but I’m not sure.) To see this in action, after you fill in the appropriate information, go try to pull up your function somewhere and watch the magic:

Visual Studio Intellisense

More information on Visual Studio Code Documentation (C#)

Happy documenting!


May 20, 2009 - Posted by | Tips & Tricks, VB.NET, Visual Studio.NET | , ,


  1. hi
    I’m using vb.net 2008 , and when typing ”’ there is no reaction act . when i using /// is c# , it works ; but i don’t know why it doesn’t work is vb . is it have a configuration to be active ?

    Comment by Amir | September 16, 2009 | Reply

  2. Amir –

    I don’t think any configuration is necessary. Are you sure you’re putting your cursor in the right spot? It should go on the line immediately above whatever you wish to describe.

    Good luck!

    Comment by Some.Net(Guy) | September 16, 2009 | Reply

  3. I found the solution for Amir’s problem. I had the same…

    In project properties the “Generate XML documentation file” has to be checked in the Compile tab. It’s almost at the bottom of that tab.

    Comment by Fredrik | September 29, 2009 | Reply

    • I have the “Generale XML documentation file” option checked, yet typing ”’ doesn’t do anything. Not sure why this is.

      Comment by Jay | November 20, 2009 | Reply

      • OK apparently you can only generate XML comments when typing ”’ above a function and indeed, when “Generate XML documentation file” is unchecked it stops working.


        Comment by Jay | November 20, 2009

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: