C# 0 The Complete Reference


PART I C h a p t e r   1 9



Download 4,07 Mb.
Pdf ko'rish
bet706/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   702   703   704   705   706   707   708   709   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt


PART I

C h a p t e r   1 9 :  

L I N Q  

563


PART IPART I

Because the sequence obtained when 



webAddrs

 is executed is a list of groups, you will 

need to use two 

foreach

 loops to access the members of each group. The outer loop obtains 

each group. The inner loop enumerates the members within the group. The iteration variable 

of the outer 



foreach

 loop must be an 



IGrouping

instance compatible with the key and 

element type. In the example both the keys and elements are 

string

. Therefore, the type of 

the

sites

 iteration variable of the outer loop is 



IGrouping

. The type of the 

iteration variable of the inner loop is 

string

. For brevity, the example implicitly declares 

these variables, but they could have been explicitly declared as shown here:

foreach(IGrouping sites in webAddrs) {

  Console.WriteLine("Web sites grouped by " + sites.Key);

  foreach(string site in sites)

    Console.WriteLine("  " + site);

  Console.WriteLine();

}


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   702   703   704   705   706   707   708   709   ...   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