C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet613/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   609   610   611   612   613   614   615   616   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

a

, 1.1 to 



b

, and “hello” to 



c

 because of the position (i.e., order) of the arguments. 

However, for an attribute, you can also create 

named parameters,

 which can be assigned initial 

values by using their name. In this case, it is the name of the parameter, not its position, that 

is important.

A named parameter is supported by either a public field or property, which must be 

read-write and nonstatic. Any such field or property is automatically able to be used as a 

named parameter. A named parameter is given a value by an assignment statement that is 

located within the argument list when the attribute’s constructor is invoked. Here is the 

general form of an attribute specification that includes named parameters:

[

attrib

(

positional-param-list

,

named-param1

 = 

value

,

named-param2

 = 

value

, ...)]


The positional parameters (if they exist) come first. Next, each named parameter is assigned 

a value. The order of the named parameters is not important. Named parameters do not 

need to be given a value. In this case, their default value will be used.

To understand how to use a named parameter, it is best to work through an example. 

Here is a version of 


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   609   610   611   612   613   614   615   616   ...   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