I just wanted to know why closed classes cannot be common types of constraints?
Suppose I have a simple code snippet in C # as below
public sealed class Base { public Base() { } } public class Derived<T> where T : Base { public Derived() { } }
When I create Derivedclass, I get "Base" is not a valid constraint. The type used as a constraint must be an interface, a non-printable class, or a type parameter.
generics c #
santosh singh
source share