To illustrate my question I've written a simple method:
public static T ConvertTo<T>(...)
where T : ISomeInterface
{
// return an instance of T
}
Obviously this method can be called like
ConvertTo<ISomeInterface>(...)
But in my case it doesn't make sense. Method should return an instance of a class that implements ISomeInterface. At now I throw NotSupportedException for any type the method unable to work with and I satisfied with this solution. But if I could filter out an interface itself in compile time it would be better.
So my question is: Is it possible to constrain generic parameter with implementations of an interface?