asp.net.ph

Skip Navigation LinksHome > Getting Started > ASP.NET Programming Languages Primer > Comments

ASP.NET Programming Languages Primer


Comments are brief explanatory notes that can be added to code for documenting what the code does.

To distinguish a comment from code, the comment is preceded by a language-specific symbol that tells the compiler to ignore the comment ( any text that follows the symbol up to the physical end of the line ). VB uses the single-quote character ( ' ) to denote a comment, while C# and JScript use a double slash ( // ).

Comments can follow a statement on the same line, or occupy an entire line. Both are illustrated in the following code.

// This is a single-line comment

String greet = "Hello";   // This is an inline comment
  C# VB JScript

NOTE: For inline and single-line comments, the text that follows the comment symbols can be any Unicode character except a line break, which terminates the comment.

C# and Jscript also support delimited or block comments. Delimited comments start with the characters /* and end with the characters */. Delimited comments may span multiple lines.

/* 
This is
a multiline
comment 
*/
  C# VB JScript

Comments can also be useful for testing code, as they provide a simple way to switch in or out a line or block of code to the compiler.

More ...
Back to top


© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note