This is a simplified version of what I need to do. In its current state, what I am trying to do doesn't make sense. However it shows the problem in a simple way.
I need to call a function2<T>() where T: TheClass, new() within a function1<T>() where T: class
Something<T> function1<T>() where T : class {
//cannot call function2 directly due to compile error
//return function2<T>();
//What I need as a pseudo code
if (T is TheClass and T is new())
return Then function2<T>()
else
throw Exception
}
Something<T> function2<T>() where T : TheClass, new() {
//...
}