Analysis of ASP. NET annotations

Source: Internet
Author: User

ASP. NET annotation code is frequently used in actual programming and can be effectively used to display the function information and interpretation of the Code. Is there any usage skills for ASP. NET annotation? Let's take a look:

ASP. NET annotation is not applicable to ASP. NET, but it is a good programming habit.

Annotations should not only describe what operations the code performs, but also indicate the reason. For example, not just in comments, it indicates that the traversal array is to calculate a value based on an algorithm, unless the algorithm is quite simple, otherwise, the algorithm should be briefly described.

Different programming languages in the. NET project have different annotation symbols. To understand ASP. NET annotations, we also pay attention to other languages. The following is a brief description:

HTML & lt ;! -- Comment -- & gt;

JavaScript // Annotation

Vbscript' comment

VB. net' Annotation

C # // Annotation

/* Comment on multiline content */

SQL -- Comment

There is no annotator In the start and end tags of the server control, but the server can ignore all attributes that it cannot recognize. Therefore, we can insert comments by using unspecified attributes. The following is an example of ASP. NET annotation:

 
 
  1. & Lt; asp: TextBox
  2.  
  3. Id ="TxtLastName"
  4.  
  5. Size ="40"
  6.  
  7. Comment ="This is my comment"
  8.  
  9. Runat ="Server"/& Gt;

It is very easy to annotate the source code in Visual Studio. NET. The lines to be annotated are displayed in High Brightness. Press Ctrl + K + C to add comments. To delete a comment, you only need to display the commented code with High Brightness and press Ctrl + K + U.

In the ASP. NET project, you can also enter the XML comment section at the beginning of each line. In the annotations section, we can use the following XML tag to organize Annotations:

 
 
  1. <summary></summary>   
  2.  
  3. <remarks></remarks >   
  4.  
  5. <param></param>   
  6.  
  7. <returns></returns>   
  8.  
  9. <newpara></newpara>  

To view the formatted reports of these XML annotations in Visual Studio. NET, select the "Tools" menu item and then select the "Create annotation Web page" menu item.

ASP. NET annotation skills will be introduced here, I hope to help you develop your programming habits.

  1. ASP. NET naming settings
  2. ASP. NET control usage tips
  3. Analysis on ASP. NET technique to improve application performance
  4. Use of StringBuilder class in ASP. NET skills
  5. Analysis of data collection procedures using ASP. NET Techniques

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.