C# 0 The Complete Reference


Attribute . Inside  RemarkAttribute



Download 4,07 Mb.
Pdf ko'rish
bet608/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   604   605   606   607   608   609   610   611   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

Attribute

. Inside 



RemarkAttribute

there is one private field, 



pri_remark

, which supports one public, read-only property: 



Remark

.

This property holds the description that will be associated with the attribute. (



Remark

 could 


also have been declared as an auto-implemented property with a private set accessor, but a 

read-only property is used for the purposes of illustration.) There is one public constructor 

that takes a string argument and assigns it to 

Remark

.

At this point, no other steps are needed, and 



RemarkAttribute

 is ready for use.



Attaching an Attribute

Once you have defined an attribute class, you can attach the attribute to an item. An attribute 

precedes the item to which it is attached and is specified by enclosing its constructor inside 

square brackets. For example, here is how 



RemarkAttribute

 can be associated with a class:

[RemarkAttribute("This class uses an attribute.")]

class UseAttrib {

  // ...

}

This constructs a 



RemarkAttribute

 that contains the comment, “This class uses an 

attribute.” This attribute is then associated with 

UseAttrib

.

www.freepdf-books.com




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   604   605   606   607   608   609   610   611   ...   1096




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish