The C# definition of ClientBase is:
public abstract class ClientBase : ICommunicationObject,
IDisposable
where TChannel : class
<
The class
constraint constraints the generic type to a reference type. An interface is, by definition, a reference type. What you can't do is use a value type as the generic type: ClientBase<int>
would be a compile time error.
As to the second error, you are not constraining TInterface
and then using it inClientBase<TInterface>
. Because ClientBase
constraints its generic type to reference types (class
), you need to constraint TInterface
accordingly.