When coding in C#, code comments are often involved, and common comments include two categories:
1) Single line comments. Format:// Comments
2) Multi-line comments. Format: /* Comments... */
C# introduces a new XML comment, that is, we start a new line in front of a function, enter ///, and automatically add annotations in XML format. Here we organize the available XML comments.
XML comments are divided into primary comments and secondary comments. The former can exist separately, while the latter must be included within the primary comment.
Level I Comment
1. <remarks> describes the type, and the function is similar to <summary>. It is said that it is recommended to use <remarks>;
2. <summary>Annotate common types of classes, methods, attributes or fields;
3. <value> is mainly used for attribute annotation, indicating the meaning of attribute system, and can be used in conjunction with <summary>;
4. <param> is used to explain the parameters of the method, format: <param name="param_name">value</param>;
5. <returns> is used to define the return value of the method. For a method, after entering ///, the <summary>, <param> list and <returns> will be automatically added;
6. <exception> defines the possible throw exception, format: <exception cref="IDNotFoundException">;
7. <example> is used to give how to use a method, attribute or field;
8. <permission>Access permission involving method;
9. <seealso> is used to refer to something else:), and you can also set properties through cref;
10. <include> is used to indicate external XML comments;
II Secondary Annotation
1. <c> or <code> is mainly used to add code segments;
2. The function of <para> is similar to the <p> tag in HTML, which is segmentation;
3. <pararef> is used to refer to a certain parameter;
4. The function of <see> is similar to <seealso>, which can indicate other methods;
5. <list> is used to generate a list;
In addition, you can also customize XML tags
1) Single line comments. Format:// Comments
2) Multi-line comments. Format: /* Comments... */
C# introduces a new XML comment, that is, we start a new line in front of a function, enter ///, and automatically add annotations in XML format. Here we organize the available XML comments.
XML comments are divided into primary comments and secondary comments. The former can exist separately, while the latter must be included within the primary comment.
Level I Comment
1. <remarks> describes the type, and the function is similar to <summary>. It is said that it is recommended to use <remarks>;
2. <summary>Annotate common types of classes, methods, attributes or fields;
3. <value> is mainly used for attribute annotation, indicating the meaning of attribute system, and can be used in conjunction with <summary>;
4. <param> is used to explain the parameters of the method, format: <param name="param_name">value</param>;
5. <returns> is used to define the return value of the method. For a method, after entering ///, the <summary>, <param> list and <returns> will be automatically added;
6. <exception> defines the possible throw exception, format: <exception cref="IDNotFoundException">;
7. <example> is used to give how to use a method, attribute or field;
8. <permission>Access permission involving method;
9. <seealso> is used to refer to something else:), and you can also set properties through cref;
10. <include> is used to indicate external XML comments;
II Secondary Annotation
1. <c> or <code> is mainly used to add code segments;
2. The function of <para> is similar to the <p> tag in HTML, which is segmentation;
3. <pararef> is used to refer to a certain parameter;
4. The function of <see> is similar to <seealso>, which can indicate other methods;
5. <list> is used to generate a list;
In addition, you can also customize XML tags