ASP. NET Code compiling specifications that should be known to beginners, asp.net code

Source: Internet
Author: User

ASP. NET Code compiling specifications that should be known to beginners, asp.net code

1. The name of a local variable must be meaningful. Use the corresponding English name, for example, the "user name" variable. Do not use aa bb cc or userName instead.

2. Do not use single-letter variables, such as I, n, and x. Instead, use index, temp, and so on. Variable exceptions used for loop iteration.

3. Use the Pascal naming method to name the method name, attribute name, class name, and namespace. Generally, the method is named as a dynamic object phrase, as shown in figure

◆ ShowDialog ();

◆ CreateFile ();

◆ GetPath ();

4. Use the Camel naming method to name parameters of local variables and methods.

The preceding examples are as follows:

Public class Neeke
{
Public Neeke ()
{

}

Private string neekeName;

Public string NeekeName
{
Get {return neekeName ;}
Set {neekeName = value ;}
}

Public void CallMe ()
{
System. Console. WriteLine ("Hello Neeke! ");
}
}

5. Only use the Hungarian naming method to name WinForm and Web spaces. Do not use textbox1, gridview1, or other default names.

6. The interface name should be prefixed with "Big and lowercase I", such as "INeeke", to distinguish interfaces and classes intuitively.

7. Use the hierarchical structure of the namespace to organize various types and interfaces.

Correct:

Using Www. Ineeke. Cn;

Namespace Ineeke. Cn
{
...
}
 

Error:

Using WwwIneekeCn;

Namespace IneekeCn
{
...
}

8. All codes must have sufficient comments. The comments must be over 15%. The content to be annotated includes the following.
1) key statements (such as key variable declaration and condition judgment ).
2) The document comment before the class name (comments starting with //) includes the simple function description and usage of the class.
3) methods with complex parameter lists.

9. Use the Tab key to indent the code. Do not use the space key.

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.