Crazy code documenting goodness

posted by Jeff | Thursday, February 28, 2008, 10:51 PM | comments: 1

I'd like to document the class library for POP Forums because it just looks more professional and it's certainly easier to use that way. It's also a pain in the ass.

I knew there was a Visual Studio plug-in called Ghost Doc that would by some miracle create documentation for you if you were using standard and widely accepted naming conventions, or just needed it to generate the obvious text. In C# we can put this stuff right next to the various class and method declarations as specially formatted comments, and then when you compile, an XML file is generated from which any number of tools generate pages of docs.

So I have a static method in my utility class that looks like this...

public static bool IsInteger(string testString)
{
if (testString == null) return false;
Regex regexNumber = new Regex("^[-]?[0-9]+$");
return regexNumber.IsMatch(testString);
}[/0-9][/-]

It knew exactly what to do...

/// <summary>
/// Determines whether the specified test string is integer.
/// </summary>
/// <param name="testString">The test string.</param>
/// <returns>
/// <c>true</c> if the specified test string is integer; otherwise, <c>false</c>.
/// </returns>

That's f'ing sweet.


Comments

Neuski

February 29, 2008, 1:24 PM #

That is sexy.


Post your comment: