Naming rules and coding specifications in C #

Source: Internet
Author: User
Code A, Hungarian nomenclature:
Naming conventions for variables (also including macros) used in Windows programming Hungarian nomenclature, which was proposed by a competent Microsoft programmer, Charles Simone (Charles Simonyi). The Hungarian nomenclature identifies the scope, type, and so on of the variable by prefixing the variable name with the corresponding lowercase letter symbol identifier. These symbols can be used simultaneously, in order of first m_ (member variables), then pointers, and then simple data types, and so on. For example: M_lpszstr, represents a long pointer member variable that points to a string ending in 0 characters.
The key to Hungarian nomenclature is that the name of the identifier is prefixed with one or more lowercase letters, followed by a word or combination of words in the first letter, indicating the purpose of the variable.
The prefix of lowercase letters commonly used in Hungarian nomenclature:
Prefix type
A array (array)
b Boolean Value (Boolean)
by bytes (byte)
C signed character (Char)
CB unsigned character (Char Byte, not many people use)
CR Color reference value (COLORREF)
Cx,cy coordinate difference (length shortint)
DW Double Word
fn function
H Handle (handle)
I integral type
L Long Integer (Long Int)
LP Long pointer
Members of the M_ class two, camel nomenclature:
Camel-style command, as its name implies, refers to the combination of uppercase and lowercase letters to form variables and function names. For example, the following is the same function named after the camel-style nomenclature and the Underline method:
Printemployeepaychecks ();
Print_employee_paychecks ();
The first function name uses the camel-named Method--each logical breakpoint in the function name is marked with an uppercase letter; the second function name uses an underscore----each logical breakpoint in the function name is marked with an underscore.
Camel-style nomenclature has become more prevalent in recent years, with many new libraries of functions and Microsoft
In an environment like windows, it is used properly. On the other hand, the underline method is popular after the advent of C, and in many old programs and UNIX environments, it is used very widely.
Iii. Pascal (Pascal) nomenclature:
Similar to the Camel nomenclature. Just camel nomenclature is the first letter lowercase, and Pascal nomenclature is the first letter capital
such as: public void displayinfo ();
String UserName;
Both of them adopt the Pascal nomenclature method.
In C #, the name of Pascal and the Camel nomenclature are mostly used.


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.