I want to write a static utility class which only has a set of properties, which expose functionality to the user
For example I could call:
Utils.String.GetHexString("Hello World");
or
Utils.Stream.CopyBytes(instream, outstream);
The closest thing I could liken this to is System.Text.Encoding where there are properties like UTF8, ASCII etc, so yo can call things like:
Encoding.UTF8.GetBytes("Hello World");
or
Encoding.ASCII.GetBytes("Hello World");
The problem is that in Encoding, this calls the equivalent objects (UTF8Encoder
, ASCIIEncoder
) which are publicly available to the user. What I want is to expose the objects ONLY via Utils, without visibilty of the objects that relate to the properties, for example
I could call:
Utils.Stream.CopyStream(instream, outstream);
but I could not call:
StreamUtils.CopyStream(instr, outstr) //This class is only accessible via the Utils class!
Is this possible, and if it is, is it going to be good or bad practice to do so?