Is there any way around this?
Yes.
You can use your attribute with the Type attribute, and then use types that implement a specific interface, for which the code processing this attribute should be used, and, as such, also creates an implicit, but, hopefully, documentary requirement for your clients:
public interface IValueRange { int Start { get; } int End { get; } } public class MyAttr : Attribute {
This is not like many classes in the System.ComponentModel namespace, such as DesignerAttribute .
Jordão
source share