I want to make util classes for System.Io (such as File, Directory etc).
Since inheritance cannot be done for static classes i want to know how would be a proper way to wrap lets say System.Io.File.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would create three types:
An interface containing all the methods you want to be able to test etc, e.g.
An implementation which delegates to the system implementation:
A fake implementation for testing:
You may well not want to put everything from
Filein there though – as many of the operations can be composed from the “core” ones. Of course, that would mean reimplementing the operations yourself, which may be undesirable…