Saturday, December 31, 2011

Example of Repetitive Comments

Looking through some old code for a project I’m working on I saw a block of code similar to this:

/// <summary>
///
This is MY method
/// </summary>
/// <param name="intValue">
Some Number</param>
/// <param name="stringValue">
Some String</param>
/// <returns>
An empty string</returns>
public string MyMethod( // Returns An empty string
int intValue, // Some Number
string stringValue) // Some String
{
return string.Empty;
}
This code annoys me. Yet I see the problem: the XML comments are just a little too far away from the actual data. I think it would be cool to have tool tips for the parameters described in XML comments. It would have also helped name the parameters better.

No comments: