Constraint syntax with generics, also deriving from a class
I'm having a heck of an issue with the following: I have a generic class, with a constraint, that derives from a non-generic interface:
public abstract class DrilldownBase<W&开发者_开发百科gt; where W : class, IDrilldown
This code is not correct through, because it thinks IDrilldown is a constraint, when its NOT. What I want is for the class DrilldownBase to inherit from IDrilldown. What am I missing?
Thanks.
Don't make it part of the constraint then.
The constraint should come after the inheritance declaration:
public abstract class DrilldownBase<W> : IDrilldown where W : class,
精彩评论