Commenting
Comments are descriptive text that is ignored by the compiler. C# provides two basic types of
comments. The first type is the single-line comment. In this case, the comment starts with two
forward slashes and continues for the entire current line. Optionally, C# programmers can also
use multiple-line comments using the /* and */ comment brackets. This trick is often used to
quickly comment out an entire block of code. This way the code won’t be executed, but it will
still remain in your source code file if you need to refer to it or use it later:
code in a standardized way. With XML comments, you use special tags that indicate whether
your comment applies to a class, method, parameter, and so on. Here’s an example of a comment
that provides a summary for an entire application:
that automated tools (including Visual Studio) can extract the comments from your code and
use them to build help references and other types of documentation. For more information
about XML comments, you can refer to an excellent MSDN article at http://msdn.microsoft.
Comments are descriptive text that is ignored by the compiler. C# provides two basic types of
comments. The first type is the single-line comment. In this case, the comment starts with two
forward slashes and continues for the entire current line. Optionally, C# programmers can also
use multiple-line comments using the /* and */ comment brackets. This trick is often used to
quickly comment out an entire block of code. This way the code won’t be executed, but it will
still remain in your source code file if you need to refer to it or use it later:
// A single-line C# comment. /* A multiline C# comment. */C# also includes an XML-based commenting syntax that you can use to describe your
code in a standardized way. With XML comments, you use special tags that indicate whether
your comment applies to a class, method, parameter, and so on. Here’s an example of a comment
that provides a summary for an entire application:
///XML comments always start with three slashes. The benefit of XML-based comments is/// This application provides web pages /// for my e-commerce site. ///
that automated tools (including Visual Studio) can extract the comments from your code and
use them to build help references and other types of documentation. For more information
about XML comments, you can refer to an excellent MSDN article at http://msdn.microsoft.
Tags:
asp.net