Make class static (ARCH711)
Ce contenu n’est pas encore disponible dans votre langue.
Key dotnet.codequality.make-class-static · Severity info · Category codequality
A class that holds only static members is meaningless to instantiate. Making the class static prevents misuse at compile time.
Incorrect
Section titled “Incorrect”public class MathHelper{ public static int Square(int x) => x * x;}Correct
Section titled “Correct”public static class MathHelper{ public static int Square(int x) => x * x;}Add the static modifier to a class that contains only static members.