Here's my code:
void DoSomething<T>()
{
var constructor = typeof(T).GetConstructor(null);
if(constructor != null)
{
DoSomethingElse<T>(); // compiler error
}
else
{
//...
}
}
void DoSomethingElse<T>() where T:new()
{
T x = new T();
//...
}
Is there a way to convince the compiler that T is a legitimate T:new()?