[ZT] XML format comment in C #

Source: Internet
Author: User
Code comments are often involved in coding. Common comments include:
1) single line comment. Format: // comments
2) multi-line comment. Format:/* comments ...*/
C # introduces a new XML annotation, that is, when we start a new line before a function, input // and vs.net will automatically add XML format annotations. Here we will sort out the available XML annotations.
XML annotations are divided into primary tags and secondary tags. The former can exist independently, and the latter must be included in the first-level annotations.
I level 1 comment
1. <remarks> describes the type. The function is similar to <summary>. It is said that <remarks> is recommended;
2. <summary> comment out classes, methods, attributes, or fields of the common type;
3. <value> is mainly used for Attribute comments, indicating the meaning of the attribute system. It can be used with <summary>;
4. <param> describes the parameters of a method. Format: <Param name = "param_name"> value </param>;
5. <returns> defines the return value of a method. After a method is input, the <summary>, <param> list, and <returns> are automatically added;
6. <exception> define an exception that may be thrown. Format: <exception CREF = "idnotfoundexception">;
7. <example> describes how to use a method, attribute, or field;
8. <permission> access permission for methods involved;
9. <seealso> is used for reference to a certain other stuff :). You can also set attributes through CREF;
10. <include> used to indicate external XML annotations;
II level 2 comment
1. <C> or <code> is mainly used to add code segments;
2. The <para> function is similar to the <p> identifier in HTML, that is, segmentation;
3. <pararef> is used to reference a parameter;
4. The <see> function is similar to <seealso>. Other methods can be indicated;
5. <list> used to generate a list;
You can also customize XML labels.
By setting the file name of the XML documentation file in the project properties, you can generate an XML file.
Another useful tool is ndoc, which can generate help files based on these annotations. However, it seems that vs.net 2005 is not supported.

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.