Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 {
}Advertisements