Should .net comments start with a capital letter and end with a period?

Posted by Hamish Grubijan on Stack Overflow See other posts from Stack Overflow or by Hamish Grubijan
Published on 2010-05-25T23:32:17Z Indexed on 2010/05/25 23:41 UTC
Read the original article Hit count: 171

Filed under:
|
|

Depending on the feedback I get, I might raise this "standard" with my colleagues. This might become a custom StyleCop rule. is there one written already?

So, Stylecop already dictates this for summary, param, and return documentation tags.

Do you think it makes sense to demand the same from comments?

On related note: if a comment is already long, then should it be written as a proper sentence?

For example (perhaps I tried too hard to illustrate a bad comment):

//if exception quit

vs.

// If an exception occurred, then quit.

If figured - most of the time, if one bothers to write a comment, then it might as well be informative. Consider these two samples:

//if exception quit
if (exc != null)
{
    Application.Exit(-1);
}

and

// If an exception occurred, then quit.
if (exc != null)
{
    Application.Exit(-1);
}

Arguably, one does not need a comment at all, but since one is provided, I would think that the second one is better.

Please back up your opinion. Do you have a good reference for the art of commenting, particularly if it relates to .Net?

Thanks.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about style