Declaring a static class documents your intent for that class to be a collection of static functionality, and anyone adding instance members will get a compilation error.
A non-static class with static members usually indicates that the class is designed to be instantiated at some point. Static methods of these classes usually do one of two things:
- Provide a factory method for creating an instance of that type;
- Provide helper functionality that does not require an instance of the type;
Also, as mentioned already, extension methods can only be declared on a static class.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…