I am looking for an optimal approach to the following problem.
I would like to see people's opinions on which method they will use, and why, in the following scenario:
I have a Class
that is created by the factory when specifying a DateTime.
Which approach should be used?
static "helper" class: Class c = ClassHelper.GetClass(DateTime);
static method for instance type: Class c = Class.GetClass(DateTime);
static class / extension method: Class c = DateTime.GetClass();
Currently, I am more inclined towards a static helper class, since I have never used the static factory method method for an instance class before, but it seems advisable to do this with a static method on the class?
Are there any considerations I should make when it comes to unit testing or test organization?
For the time being, I avoided extension methods when I read that extension methods should be used sparingly, usually if you don't have access to the source that you are distributing?
Greetings
James
source share