Mhazad's Blog

March 15, 2010

Modifying GhostDoc XML Comment

Filed under: Code Commenting, Documentation — Mahmudul Haque Azad @ 5:25 am

Today while browsing I came across Matthew M. Osborn’s Blog and I found this fantastic line

“Documentation is the coders best and worst friend. It is a two sided sword, it makes your life easier but no one likes writing it. So coders do what we do best and find a way to make the computer do it for us.”

Ideally I use GhostDoc to make comments for my codes and really it works fine for me. From the very first day since I have been using this, I always thought whether I can change the xml documentation as per my need or not.

Today I have found a simple trick to add to custom node to the xml commenting.

Here was my scenario,

All my method/class/event level comment must include author name along with the time when it was written.

For this I need to add the following lines in the Ghost Doc > Options > Custom Texts

<author>$(Environment.UserName)</author>
<datetime>$(Environment.Date)-$(Environment.Time)</datetime>

And the ghost doc generated comment contains author and datetime tag!!!

///<summary>
/// Gets the user by ID.
///</summary>

///<param name=”ID”>The ID.</param>
///<returns></returns>

///<author>Mahmudul.Haque</author>
///<datetime>3/15/2010-11:23 AM</datetime>
private static User GetUserByID(long ID)
{
User user = new User();
return user;
}

Advertisements

Create a free website or blog at WordPress.com.