Maintainability Rules


A C# code file contains more than one unique class.

Rule Description

A violation of this rule occurs when a C# file contains more than one class. To increase long-term maintainability of the code-base, each class should be placed in its own file, and file names should reflect the name of the class within the file.

It is possible to place other supporting elements within the same file as the class, such as delegates, enums, etc., if they are related to the class.

It is also possible to place multiple parts of the same partial class within the same file.

How to Fix Violations

To fix an instance of this violation, move each class into its own file.