Asp. NET Code Writing specification

Source: Internet
Author: User

1. Local variable name to be meaningful, as far as possible with the corresponding English name, such as "User name" variable, do not use AA bb cc, etc. to name, but to use username.

2. Do not use a single letter of variables, such as I, N, X, and so on. and to use index, temp and so on. The variable exception for the loop iteration.

3. Pascal nomenclature should be used to name the method name, attribute name, class name, and namespace, and the method name is generally named as the verb-object phrase, as

ShowDialog ();

CreateFile ();

GetPath ();

4. Name The local variables and the parameters of the method using the Camel naming method.

The above several comprehensive 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. Naming WinForm and web spaces using Hungarian nomenclature only, prohibiting the use of default names such as TextBox1, GridView1, etc.

6. Interface naming takes the case I as a prefix, such as Ineeke, to visually differentiate between interfaces and classes.

7. Use the hierarchical structure of namespaces to organize various classes and interfaces.

That's right:

Using Www.Ineeke.Cn;

Namespace ineeke.cn
{
...
}

Error:

Using WWWINEEKECN;

Namespace INEEKECN
{
...
}

8. All code must be guaranteed to have sufficient annotation, the annotation quantity requests above 15%. What you need to annotate includes the following.
1 key statements (such as key variable declarations, conditional judgments, etc.).
2 The document annotation (which begins with//) before the class name includes a simple function description of the class, the usage method, etc.
3 A method with a complex parameter list.

9. Code indentation with the TAB key, do not use the space bar.



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.