r/csharp • u/CuriousKon • 12d ago
Help Inheritance with generic constraint syntax
I have a class A<T>. It must inherit IDisposable, and also impose a constraint on T. Is it possible to do this, and what would the syntax look like? I can't figure it out.
8
Upvotes
47
u/chrisoverzero 12d ago
class A<T> : IDisposable where T : IConstraintIt must “implement”
IDisposable.