"Go" writing high-quality Code 157 recommendations for improving C # programs--Recommendation 133: Naming private fields and local variables with camelcasing

Source: Internet
Author: User

Recommendation 133: Name private fields and local variables with camelcasing

Private variables and local variables are only responsible for this type, and they also adopt and open different methods of properties and fields in the naming scheme. Camelcasing is well suited for this type of naming.

The difference between camelcasing and pascalcasing is that its initials are lowercase. These two different naming conventions are used to make it easier for developers to differentiate them quickly. For example:

    classPerson {Private stringFirstName; Private stringLastName;  Public stringName {Get{return string. Format ("{0} {1}", FirstName, lastName); }        }        Private intDoSomething (intAintb) {intITemp =Ten; returnA + B +iTemp; }    }

As we can see, all private fields, including the method's parameters and local variables, all follow the camecasing rules of the first letter lowercase. Once out of this rule, it is easy to confuse yourself during the coding process.

Turn from: 157 recommendations for writing high-quality code to improve C # programs Minjia

"Go" writing high-quality Code 157 recommendations for improving C # programs--Recommendation 133: Naming private fields and local variables with camelcasing

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.