Can C# generics have a specific base type?

c#, generics

Solution

public interface IGenericFace<T> where T : SomeBaseClass

Problem

Is it possible for a generic interface's type to be based on a specific parent class? For example: ``` public interface IGenericFace<T : BaseClass> { } ``` Obviously the above code doesn't work but if it did, what I'm trying to tell the compiler is that `T` must be a sub-class of `BaseClass`. Can that be done, are there plans for it, etc.? I think it would be useful in terms of a specific project, making sure a generic interface/class isn't used with unintended type(s) at compile time. Or also to sort of self-document: show what kind of type is intended.

Original source