I have a class with several constructors, and I want to name the "main" one from the other, but using null.
Using only this(null)leads to a compile-time error, so I pass null to the type of another constructor. Compiles fine.
MyClass
{
public MyClass(SomeType t)
{ }
public MyClass(IList<FooType> l)
: this((SomeType)null)
{ }
}
It feels, let's just say icky. Is it good, ordinary, or crazy and shows a flaw in the class - that it should have an empty constructor?
For the class, "mostly" is required SomeType, but there are rare cases when everything is in order so that it does not exist. I want rare times to stick out and be obvious that something is “not typical” with the code.