The definition of a class begins with the keyword class, followed by the class name; the class body is enclosed by a pair of curly braces. The following is the convention for class names.
The encoding convention for class names is the name of the class name, for example, Pascal nomenclature should be used.
public class EmployeeDetails {}
Above, the class name EmployeeDetails adopts PascalCasing format.
Prefer to add the class name as a noun or noun phrase-
public class Employee {}
Identifier is used to identify a class, variable, function or any other user The name of the definition item. The following is the naming convention for identifiers -
It cannot contain any embedded spaces or symbols, such as ? - ! @#%^&*()[]{}. ; : " ' / and \. However, the underscore ( _ ) can be used.
It should not be a C# keyword.
The above is the detailed content of Naming conventions in C#. For more information, please follow other related articles on the PHP Chinese website!