Why is this an issue?

When a class has only a private constructor, it can’t be instantiated except within the class itself. Such classes can be considered dead code and should be fixed

Exceptions

How to fix it

Code examples

Noncompliant code example

public class MyClass // Noncompliant: the class contains only private constructors
{
  private MyClass() { ... }
}

Compliant solution

public class MyClass // Compliant: the class contains at least one non-private constructor
{
  public MyClass() { ... }
}

Resources

Documentation

Articles & blog posts