.NET Framework General Reference - Capitalization Styles

xiaoxiao2021-03-06  42

Use The Following Three Conventions for Capitalizing Identifiers.

Pascal case

THE FIRSTLETER in The Identifier and The First Letter of Each Subsequent Concatenated Word Are Capitalized. You Can Use Pascal Case for Identifiers of Three Or More Characters. For example:

Backcolor

Camel Case

THE FIRSTLETER OF An Identifier Is LowerCase and The First Letter of Each Subsequent Concatenated Word Is Capitalized. For Example:

Backcolor

Uppercase

All letters in the identifier area capitalized. Use this const of two or feWer letters. For example:

SYSTEM.IO

System.Web.ui

You might also have to capitalize identifiers to maintain compatibility with existing, unmanaged symbol schemes, where all uppercase characters are often used for enumerations and constant values. In general, these symbols should not be visible outside of the assembly that uses them.

The Following Table Summarizes The Capitalization Rules and Provides Examples for the Different Types of Identifiers

IdentifierCaseexamplexamplePascalappdomainnum TypeScalrRlevelenum VALUESPASPASCALFATALROREVENTPASCALRALUECHANGEXCEPTION CLASSPASCALWEBEXCEPTION

Note Always Ends with the suffix

EXCEPTION.

Read-Only Static FieldPascalRedValueInterfacePascalidisposable

Note Always Begins with the prefix

I.

MethodPascaltostringNamespacePascalsystem.drawingParameterCamelTypenamePropertyPascalbackColorProtected Instance FieldcamelredValue

Note Rarely used. A property is preformed to using a protected instance field.

Public Instance FieldPascalRedValue

Note Rarely used. A property is preformed to using a public instance field.

转载请注明原文地址:https://www.9cbs.com/read-58987.html

New Post(0)