Adding Comments

Adding Comments

Comments in Code Files

  • A programming language construct used to embed readable annotations in source code
  • Used to describe intention, algorithmic overview, and/or logical flow
  • Careful commenting can make source code easier to read and maintain

Commenting Guidelines

  • Place comments above the code instead of beside it
  • Begin comment text with an uppercase letter
  • End comment text with a period
  • Insert one space between the comment delimiter (//) and the comment text
  • Do not create formatted blocks of asterisks around comments

Commenting Syntax for Code Files

  • // Add a single-line comment behind this symbolic construct  in C# code behind files and JavaScript files
  • /* Add single-line or multiline comments between these symbolic constructs  in C# code behind files, CSS files and JavaScript files */
  • <!-- Add single-line or multiline comments between these symbolic constructs in .ascx, .aspx, .html and .xslt files -->
  • @* Add single-line or multiline comments between these symbolic constructs in .cshtml files *@
  • <xsl:comment>Add multiline comments between these symbolic constructs in .xslt files </xsl:comment>
  • # add single line comments behind this symbolic construct in hosts files

Sources