The constructor for my class has three variables passed to it:
public MyClass(int Id, String Name, DateTime StartDate)
But, StartDate might be passed into the variable as a String or as a DateTime object.
Should I create two different constructors one specifying DateTime for StartDate and one as String? Or, should I make the type Dynamic and determine what it is at run time and handle it then? I ask because my class has five dates and if I were to write constructors for every different combination, that would be way too much code.
Define an overload of the constructor that calls your default constructor:
I would only create a constructor that accepts all as DateTime objects and an overload that accepts all as strings. I would ignore any other combination. In fact, I would only accept DateTime.
Accepting a dynamic type would result in a poor interface.