-------Naming conventions for C # Foundation review

Source: Internet
Author: User

(1) Capitalization of names

Pascal case Form Rules

In the name of the first letter of the word, the namespace, the class, and the member names in the base class should follow this rule

Using System;

Class Program

Camel Case Form Rules

Similar to the Pascal form but with the first letter lowercase

The following three cases can be used in camel rules

1, the name of the field for all private members of the type: private int userId But note that member fields are often prefixed with the private int _userid

2, the parameter passed to the method SetPassword (string userid,string passWord)

3, distinguish two fields of the same name

private String ManagerName

public string ManagerName

{

Get

{

return managername;

}

}

(2) The style of the name

The name style should be uniform, if one of the methods in a class is named Showconfirmdailog (), and the other method cannot be named Showdailogmessage (), it should be named Showmessagedailog ();

(3) Name of the namespace

The name of the namespace is very important, you cannot have the same name as other namespaces, try to create a top-level space with your company name, and then name the project in the same group.

(4) Name and keywords

Name cannot conflict with keyword

-------Naming conventions for C # Foundation review

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.