C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet348/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   344   345   346   347   348   349   350   351   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

set

 or 


get

 accessor can be modified, not both. Furthermore, the access modifier must 

be more restrictive than the access level of the property or indexer. Finally, an access 

modifier cannot be used when declaring an accessor within an interface or when implementing 

an accessor specified by an interface. (Interfaces are described in Chapter 12.)

Using Indexers and Properties

Although the preceding examples have demonstrated the basic mechanism of indexers and 

properties, they haven’t displayed their full power. To conclude this chapter, a class called 

RangeArray

 is developed that uses indexers and properties to create an array type in which 

the index range of the array is determined by the programmer.

As you know, in C# all arrays begin indexing at zero. However, some applications would 

benefit from an array that allows indexes to begin at any arbitrary point. For example, in 

some situations it might be more convenient for an array to begin indexing with 1. In another 

situation, it might be beneficial to allow negative indexes, such as an array that runs from –5 

to 5. The 




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   344   345   346   347   348   349   350   351   ...   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