XML Documentation in Visual Studio using GhostDoc

In this article we will explore how to generate the xml documentation in Visual Studio for our .NET code.

Basically Every .NET assembly can contain the comments as documentation which we place after ‘///'(Triple slash) in our code.

For example:
If we write the following code in visual studio it gets assigned into assembly as xml documentation:

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        ///XML Comment
        ///Can be used to generate a document 
        ///using tools like NDoc
     }
     

Now there exists a wonderful tool GhostDoc which can automate this documentation for you. It basically extracts the documentation from the documentation of the original classes embeds it into the code.

The documentation for the page load method in the above example changed with the help of GhostDoc like this:

/// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    /// *************************************************************
    /// Created By: Ankit Goyal
    /// Date: 5/22/2009
    /// Time: 12:06 PM
    /// *************************************************************
    protected void Page_Load(object sender, EventArgs e)
    {   
    }
    

The quality of documentation which GhostDoc generates also depends on the names of classes method and variables you create. Conventions if followed along with GhostDoc produces superb documentation at ease.

Now once the xml documention has been embedded into the code it can be used to create msdn type help file for the code. To know about it please visit:
Help file from XML Documentation using NDoc

References:
Ghostdoc Home Page

kick it on DotNetKicks.com

Shout it

pimp it

Anky Goyal

I am MCPD certified in .NET and working on .NET technologies for past 3yrs. I am very passionate about the new features which get introduced in the technology. I am here to share the new features i get to know in the world of Microsoft. Follow me on twitter @ankygoyal [email protected]Ankit Goyal

More Posts - Website