C # Summary of three naming methods commonly used in programming

Source: Internet
Author: User
Tags variable scope
C # Summary of three naming methods commonly used in programming

1. Camel-Type COMMAND: a mix of uppercase and lowercase letters is used to form the name of a variable and a function. Lowercase letters.
2. Pascal naming: A combination of uppercase and lowercase letters is used to form the names of variables and functions. Uppercase letters.
3. Hungary naming method: the variable scope and type are identified by prefixing the variable name with the symbol of the corresponding lower-case letters.

(The Key to the Hungarian naming method is: the identifier name starts with one or more lower-case letters as the prefix; the prefix is followed by a word or a combination of multiple words in the upper-case letters, this word indicates the purpose of the variable. Where, it indicates a member of the class starting with "M)

Instance:
Mydata is a camel name;
Mydata is named after Pascal;
Imydata is a Hungarian name. Its lowercase I indicates its form. The latter name is the same as Pascal's, indicating the purpose of the variable;

Personal suggestion: Do not stick to one form. Use it in combination, take its essence, and discard its dregs:
1. The member fields of the class start with "M _" by using the Hungary name;
2. The class name, method name, and function name are identified by Pascal;
3. Parameters of the method. Local variables use the camel command method;

C # example:

 1   Namespace Mycompany. myproject. Test
2 {
3 Class Testprogram
4 {
5 Private Static String M_result = String . Empty;
6
7 Static Void Maintest ( String [] ARGs, Bool Iscomplete)
8 {
9 Int I = 0 ;
10 VaR Filename = " Test.mp4 " ;
11 }
12 }
13 }

1. Camel-Type COMMAND: a mix of uppercase and lowercase letters is used to form the name of a variable and a function. Lowercase letters.
2. Pascal naming: A combination of uppercase and lowercase letters is used to form the names of variables and functions. Uppercase letters.
3. Hungary naming method: the variable scope and type are identified by prefixing the variable name with the symbol of the corresponding lower-case letters.

(The Key to the Hungarian naming method is: the identifier name starts with one or more lower-case letters as the prefix; the prefix is followed by a word or a combination of multiple words in the upper-case letters, this word indicates the purpose of the variable. Where, it indicates a member of the class starting with "M)

Instance:
Mydata is a camel name;
Mydata is named after Pascal;
Imydata is a Hungarian name. Its lowercase I indicates its form. The latter name is the same as Pascal's, indicating the purpose of the variable;

Personal suggestion: Do not stick to one form. Use it in combination, take its essence, and discard its dregs:
1. The member fields of the class start with "M _" by using the Hungary name;
2. The class name, method name, and function name are identified by Pascal;
3. Parameters of the method. Local variables use the camel command method;

C # example:

 1   Namespace Mycompany. myproject. Test
2 {
3 Class Testprogram
4 {
5 Private Static String M_result = String . Empty;
6
7 Static Void Maintest ( String [] ARGs, Bool Iscomplete)
8 {
9 Int I =0 ;
10 VaR Filename = " Test.mp4 " ;
11 }
12 }
13 }
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.