PART I
C h a p t e r 1 7 :
R u n t i m e T y p e I D , R e f l e c t i o n , a n d A t t r i b u t e s
491
PART IPART I
One last point: For both positional and named parameters, the type of an attribute
parameter must be either one of the built-in primitive types,
object
,
Type
, an enumeration,
or a one-dimensional array of one of these types.
Three Built-in Attributes
C# defines several built-in attributes, but three are especially important because they apply
to a wide variety of situations:
AttributeUsage
,
Conditional
, and
Obsolete
. They are
examined here.
AttributeUsage
As mentioned earlier, the
AttributeUsage
attribute specifies the types of items to
which an attribute can be applied.
AttributeUsage
is another name for the
Do'stlaringiz bilan baham: |