c# - Why can't I set both XmlAttribute and XmlElement as generic constraint? -
i'm trying set xmlattribute
, xmlelement
allowed types generic type when i'm setting both of them same time i'm getting error during compilation:
the class type constraint 'system.xml.xmlelement' must come before other constraints
example of code:
interface testclass<t, t2> : ienumerable t2: xmlattribute, xmlelement { ... }
why wouldn't allow me set constraints this?
the constraint using not represent list of allowed types. means "anything inserted t2
must inherit ."
this compiler can sure inserted t2
provides public interface - properties , methods -, namely inherited specified type. if list more 1 alternative there, interface taken granted? depending on inserted, t2
have either methods , properties offered xmlattribute
or methods , properties offered xmlelement
, none of them sure.
Comments
Post a Comment