Information Technology Reference
In-Depth Information
Comments: Annotating the Code
You have already seen single-line comments, so here I'll discuss the second type of inline com-
ments— delimited comments —and mention a third type called documentation comments.
￿
Delimited comments have a start marker and an end marker.
￿
Text between the matching markers is ignored by the compiler.
￿
Delimited comments can span any number of lines.
For example, the following code shows a delimited comment spanning multiple lines.
Beginning of comment spanning multiple lines
/*
This text is ignored by the compiler.
Unlike single-line comments, delimited comments
like this one can span several lines.
*/
End of comment
A delimited comment can also span just part of a line. For example, the following state-
ment shows text commented out of the middle of a line. The result is the declaration of a single
variable, var2 .
Beginning of comment
int /*var 1,*/ var2;
End of comment
Note Single-line and delimited comments behave in C# just as they do in C and C++.
Search WWH ::




Custom Search