
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What are the rules for naming classes in C#?
A class definition starts with the keyword class followed by the class name; and the class body enclosed by a pair of curly braces.
The following is the syntax −
<access specifier> class class_name { // member variables <access specifier> <data type> variable1; <access specifier> <data type> variable2; ... <access specifier> <data type> variableN; // member methods <access specifier> <return type> method1(parameter_list) { // method body } <access specifier> <return type> method2(parameter_list) { // method body } ... <access specifier> <return type> methodN(parameter_list) { // method body } }
The following are the conventions for class names −
Pascal Casing
The coding conventions for a class name is the name of the class name, for example, it should being PascalCasing −
public class CalculateCost { }
Above, the class name CalculateCost is in PascalCasing.
Noun or Noun Phrases
Prefer adding class names as noun or noun phrases −
public class Department { }
- Related Articles
- Java variable naming rules
- What are the identity rules for regular expression?
- What are the basic rules for JavaScript parameters?
- What are the rules for a functional interface in Java?
- What are the basic rules for defining variables in C++?
- What are the rules for the Subscriber interface in Java 9?
- What are the rules for the Subscription interface in Java 9?
- What are the rules for the Publisher interface in Java 9?
- What are the golden rules for handling your money?
- What are the basic scoping rules for python variables?
- What are Variable Naming Conventions in JavaScript
- What are the rules for calling the superclass constructor C++?
- What are the scoping rules for lambda expressions in Java?\n
- What are the rules for local and global variables in Python?
- What are the rules for the body of lambda expression in Java?

Advertisements