C# naming rules

Pascal rule
capitalize the letter at the beginning of each word

Camel rule
capitalize the beginning letters of words except the first word

Upper rule
is only used for abbreviated naming of constants with a length of one or two characters. Pascal rules should be applied for more than three characters.

Class naming

1. Class names should be nouns and noun phrases, and use complete words as much as possible
2. Use Pascal rules
3. Do not use class prefixes-do not use underscore characters _

Interface naming

1. The interface name should be nouns and noun phrases or adjectives describing its behavior, and use complete words as much as possible

2. Use Pascal rules
3. Use the character I as a prefix, followed by an uppercase letter (that is, the first letter of the interface name is uppercase)

Variable naming

1. Use i, j, k, l, m, n for counter variables in simple loop statements
2. Use Camel naming rules

Method naming

1. Use Pascal rules

2. The recommended name should be a verb or a verb phrase
3. Do not repeat the name of the class in the method

Attribute naming

1. The name should be a noun and noun phrase

2. Use Pascal rules
3. Use Is (is) as a prefix for bool type attributes or variables

Collection naming

1. The name should be a noun and noun phrase

2. Use Pascal rules
3. Add Collection after the name

Guess you like

Origin blog.csdn.net/dingmengwei/article/details/111167902