This rule states that a class should be declared as static if it only contains static members. Declaring a class as static indicates that it cannot be instantiated or extended and that all its members are static. This provides a clear signal to other developers that this class is not meant to be used as an object.
What the rule detects
The rule detects if all members are static . If they are, the rule recommends to declare the class static.
How to fix the issue?
Declare the class static by adding the static keyword to its declaration.
Non-Compliant Code Examples
// all attributes are static, the class should be staticpublicclassFoo{privatestaticstring_f;publicstaticvoidBar(){}}publicclassFooBar{privatestaticreadonlyIList<MyObject>LargeCollection;FooBar(){stringjson=System.IO.File.ReadAllText(TestFixtureBase.ResolvePath("large.json"));LargeCollection=JsonConvert.DeserializeObject<IList<RootObject>>(json);}publicstaticvoidPlop(){}}