Finally, document your static classes well.
最后,请对您的静态类进行很好的记录。
Can be used as an alternative to static classes.
可以用作静态类的替代品。
You should also remember that static classes that preserve state between method calls should be made thread safe by default.
您还应该记得,在方法调用之间保留状态的静态类在默认情况下应该是线程安全的。
Describes guidelines for designing static classes.
描述设计静态类的准则。
Extension methods can only be declared in static classes.
扩展方法仅可声明在静态类中。
Do not declare or override instance members in static classes.
不要声明或重写静态类中的实例成员。
The following guidelines help ensure that your static classes are correctly designed.
下面的准则有助于确保正确设计静态类。
Do declare static classes as sealed and abstract, and add a private instance constructor, if your programming language does not have built-in support for static classes.
如果编程语言没有对静态类的内置支持,则应将静态类声明为密封的和抽象的,并添加一个私有实例构造函数。
Static classes should be used only as supporting classes for the object-oriented core of the framework.
静态类只应用作面向对象的框架核心的支持类。
Static classes should be used only as supporting classes for the object-oriented core of the framework.
静态类只应用作面向对象的框架核心的支持类。
应用推荐