S2094 — Classes should not be empty

Language
VB.NET
Type
Code smell
Severity
Minor
Tags
clumsy

Why is this an issue?

There is no good excuse for an empty class. If it’s being used simply as a common extension point, it should be replaced with an interface. If it was stubbed in as a placeholder for future development it should be fleshed-out. In any other case, it should be eliminated.

Noncompliant code example


Public Class Empty ' Noncompliant

End Class

Compliant solution


Public Interface IEmpty

End Interface

Exceptions


Imports Microsoft.AspNetCore.Mvc.RazorPages

Public Class EmptyPageModel ' Compliant - an empty PageModel can be fully functional, the VB code can be in the vbhtml file
    Inherits PageModel
End Class

↑ Back to top