There's nothing inherently wrong with static
classes, although they should typically not have state (fields). Your use of public static
fields indicates that this is not the case, so it seems like you are using abusing the static
keyword slightly. If your class needs to have state, then it should be a normal, non-static class, and you should create instances of it. Otherwise, the only public fields visible on the class should be const
(consider the Math
class, with constants such as Math.PI
- a good use of static
methods and fields).
Another consideration is cohesion. Methods typically exist grouped in one class because they are closely related in one way or another. Again, the Math
class is a good example; everything in there has to do with maths. At some point, you would want to split your global utility class into multiple smaller, more focussed ones. See Wikipedia for some examples on cohesion, it sounds like your usage falls under "Coincidental cohesion (worst)".
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…