HASSANHABIB

§ 1 — The C# Coding Standard

Files

1 min read · chapter 1 of 5

The following are the naming conventions and guidance for naming C# files.

Naming

File names should follow the PascalCase convention followed by the file extension .cs.

Do

Student.cs

Also, Do

StudentService.cs

Don't

student.cs

Also, Don't

studentService.cs

Also, Don't

Student_Service.cs

Partial Class Files

Partial class files are files that contain nested classes for a root file. For instance:

  • StudentService.cs
    • StudentService.Validations.cs
    • StudentService.Exceptions.cs

Both validations and exceptions are partial classes to display a different aspect of any given class in a multi-dimensional space.

Do

StudentService.Validations.cs

Also, Do

StudentService.Validations.Add.cs

Don't

StudentServiceValidations.cs

Also, Don't

StudentService_Validations.cs

This chapter lives on GitHub, where it is written in the open. Read the source or suggest a change.