C# 0 The Complete Reference


Inventory  as a  type argument to  List



Download 4,07 Mb.
Pdf ko'rish
bet992/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   988   989   990   991   992   993   994   995   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

Inventory

 as a 


type argument to 

List

. Other than that, the two programs are nearly identical. The fact 

that the use of a generic collection requires virtually no additional effort and adds type 

safety argues strongly for its use when storing a specific type of object within a collection.

In general, there is one other thing to notice about the preceding programs: Both are 

quite short. When you consider that each sets up a dynamic array that can store, retrieve, 

and process inventory information in less than 40 lines of code, the power of collections 

begins to become apparent. As most readers will know, if all of this functionality had to be 

coded by hand, the program would have been several times longer. Collections offer ready-

to-use solutions to a wide variety of programming problems. You should use them 

whenever the situation warrants.

There is one limitation to the preceding programs that may not be immediately apparent: 

The collection can’t be sorted. The reason for this is that neither 


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   988   989   990   991   992   993   994   995   ...   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