Mike P <mi*******@gmai l.comwrote:
What would be the reason for creating a class just with static methods
acting on another class?
It collects them together. Often you can't add methods to a class
itself, because you don't have the code - I can't add the Reverse
method to string, for example.
If you're going to frequently do the same things with an instance of a
class, it's worth putting that somewhere rather than repeating the
code.
Another example is in my miscellaneous utility library
(
http://pobox.com/~skeet/csharp/miscutil) - I've got a helper class for
working with streams. It has a set of methods to copy the contents of
one stream to another, and another set to read the complete contents of
a stream as a byte array.
--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too