Aren't classes supposed to be called after objects and not actions? It just does not sit along with OO theory I learned.
One thought was that maybe since Convert holds only static methods then no instances of it are supposed to be created at all, which might make it an acceptable exception.
In C# you can't create methods outside classes or structs. So when you want to create utility methods, it's best to store them in a static class.
So i would say that there's nothing object oriented about a static class.
There's nothing object-oriented about the Convert class, because object-orientation is about data with behaviour, and the Convert class holds no data or state.
It's basically a practical consideration.
In Eiffel, for example, the conversion methods would have been defined in a base class, and all classes needing to use the conversion methods would have derived from that base class. However, Eiffel has multiple inheritance, so that makes sense for Eiffel, but not for a language like C# where you don't have multiple inheritance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With