I would like to implement a C # common class that looks something like this:
abstract class Foobar<T> : AbstractBase, T { ... }
This is not the case, because C # will allow types after the base class is an interface, so next time I will try:
abstract class Foobar<T> : AbstractBase, T where T : interface { ... }
But then I discovered that C # does not allow this form of type restriction. Only where T : struct and where T : class allowed.
How can I say that a type parameter should only be an interface?
generics c # type-constraints
pauldoo
source share