Is there a design-time mechanism to check if two attributes are being applied to the same object?
I have created two attributes, [MyXAttribute] and [MyYAttribute], say, but I would like a design-time check to make sure only one is used on a field.
This is similar to using the AllowMultiple=false, except that applies to using two instances of the same attribute.
I tried inheriting from the same base Attribute, [MyAttribute], with AllowMultiple=false on that base, but there is no check.
Thank you.
If the two attributes are mutually exclusive, then you might consider merging them, and then differentiating their usage with an enum or bool parameter. That way AllowMultiple=false will do the job for you.
Something like: