GU0024
November 24, 2021 ยท View on GitHub
Seal type with default member
| Topic | Value |
|---|---|
| Id | GU0024 |
| Severity | Info |
| Enabled | True |
| Category | Gu.Analyzers.Correctness |
| Code | ClassDeclarationAnalyzer |
Description
Seal type with default member.
Motivation
When doing SomeType.Default the expectation is to get an instance of type SomeType.
How to fix violations
Use the code fix.
Configure severity
Via ruleset file.
Configure the severity per project, for more info see MSDN.
Via #pragma directive.
#pragma warning disable GU0024 // Seal type with default member
Code violating the rule here
#pragma warning restore GU0024 // Seal type with default member
Or put this at the top of the file to disable all instances.
#pragma warning disable GU0024 // Seal type with default member
Via attribute [SuppressMessage].
[System.Diagnostics.CodeAnalysis.SuppressMessage("Gu.Analyzers.Correctness",
"GU0024:Seal type with default member",
Justification = "Reason...")]