C # basic introduction -- C # comments,

Source: Internet
Author: User

C # basic introduction -- C # comments,

Annotation is some "descriptive text" in the code ". Annotations are not involved in program compilation and running, and are only for programmers to read.

 

Comments can be divided into single-line comments, multi-line comments, and document comments.

 

The symbol for a single line comment is two slash "//", and the content on the right of the two slashes is the comment, and the Code on the left is not affected.

 

Multi-line comments start with "/*" and end with "*/". The content between comments can contain multiple rows.

 

A document comment is written before a class, method, or attribute. It is marked with three slash "//".

 

1 namespace Test 2 {3 /// <summary> 4 // This class implements "hello" (document comment) 5 /// <summary> 6 class Program 7 {8 static void Main (string [] args) 9 {10/* 11 * Below is the variable declaration 12 * the second line is the output 13 * (multi-line comment) 14 */15 string name = "Mary "; // name (single line comment) 16 Console. writeLine ("My name is" + name); 17} 18} 19}

 

Note: The Console. WriteLine () in the Code is different from the previous Console. Write (). The latter does not wrap, and the former will wrap after printing.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.