T Y P E R E F L E C T I O N, L AT E B I N D I N G, A N D AT T R I B U T E - B A S E D P R O G R A M M I N G
Furthermore, [AttributeUsage] also allows you to optionally
set a named property
(AllowMultiple) that specifies whether the attribute can be applied more than once on the same
item. As well, [AttributeUsage] allows you to establish whether the attribute should be inherited
by derived classes using the Inherited named property.
To establish that the [VehicleDescription] attribute can be applied only once on a class or
structure (and the value is not inherited by derived types), you can update the
VehicleDescriptionAttribute definition as follows:
Do'stlaringiz bilan baham: