Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
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.
// 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(){}}