BaseTypeRequiredAttribute to specify One OF given types
The documentation for BaseTypeRequired suggests that it is possible to specify multiple required types, but does not specify whether this is AND or OR.
Further, when I specify two possibilities, on my new attribute, where the types are BOTH derived from a shared base class, I get a "Conflict" message. However, I want to explicitly limit the types, so the third derived class is NOT valid for decoration by my attribute.
Can anyone shed any light ?
Example
[BaseTypeRequired(typeof D1)]
[BaseTypeRequired(typeof D2)]
class MyAtt : Attribute {}
class MyBase {}
class D1 : MyBase {}
class D2 : MyBase {}
class D3 : MyBase {}
I need to ensure that I cannot add MyAtt to D3.
Please sign in to leave a comment.
The types in the attributes has "AND" semantic and are designed for cases when multiple base interfaces are required. There is no way to limit "D3" from marking by "MyAtt" using BaseTypeRequired