TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
C# Coding Standard

Rule:  7@102Checked automatically with code checker

Synopsis:Prevent instantiation of a class if it contains only static members
Severity Level:5
Category:Object oriented


If a class only contains static members there is no use to instantiate it. The way to prevent instantation is to mark the class as static.

Note that a static class can't be inherited from because there is no use for it (children are only accessible via class names not via instances). So if you have a class with only static methods and it has children, then it is recommended to make a utility class instead.

Literature References:
StackOverflow should a class with only static methods be static?
StackOverflow why can't I inherit from a static class?