C#idiomatic C#
ca1053fundamentals/code-analysis/quality-rules

Code analysis

CA1053: Static holder types should not have default constructors

Learn about code analysis rule CA1053: Static holder types should not have constructors

CA1053 Design enabled by default in .NET 10: No
Fix is breaking or non-breaking BreakingApplicable languages C# and Visual Basic

Cause

A public or nested public type declares only static members and has a default constructor.

Rule description

The default constructor is unnecessary because calling static members does not require an instance of the type. Also, because the type does not have non-static members, creating an instance does not provide access to any of the type's members.

How to fix violations

To fix a violation of this rule, remove the default constructor.

When to suppress warnings

Do not suppress a warning from this rule. The presence of the default constructor suggests that the type is not a static type.