Tuesday, 1 March 2016

Comments

Comments are used to document what the program does and what specific blocks or lines of code do. C# compiler ignores comments.

Single line Comments                       -   //
Multi line Comments                     -   /*  */
XML Documentation Comments      -   ///

1. Single line comments
  // Retrieve and print odd numbers from the array

2. Multi line comments 
  /* Retrieve and print odd numbers from the array
                         odd numbers from the array */

3. Introduction to XML documentation comments  
    
///    This is a sample summary comment
///    using the 'summary' xml tag.
To Comment and Uncomment, there are 2 ways

1. Use the designer
2. Keyboard Shortcut: Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U

Note: Don't try to comment every line of code. Use comments only for blocks or lines of code that are difficult to understand

0 comments:

Post a Comment