i'm implementing a generic interface (iqueryprovider, specifically). at some point, i'm forced to return a generic result, that i need to get from some internal interface:
public TResult Execute<TResult>(...) {
return something.Foo<TResult>();
}
where something.Foo is
public T Foo<T>() where T: MyBaseClass, new() {
...
}
this of course blows up because the externally defined TResult doesn't have the same type restrictions as the internally-defined T. the question: is there a way to make TResult palatable to Foo? can i somehow explicitly test for those two conditions and coerce the type variable?