C# Language Specification


Select and groupby clauses with continuations



Download 0,75 Mb.
bet276/524
Sana06.01.2022
Hajmi0,75 Mb.
#324842
1   ...   272   273   274   275   276   277   278   279   ...   524
Bog'liq
CSharp Language Specification

Select and groupby clauses with continuations


A query expression with a continuation

from into x …

is translated into

from x in ( from )

The translations in the following sections assume that queries have no into continuations.

The example

from c in customers
group c by c.Country into g
select new { Country = g.Key, CustCount = g.Count() }

is translated into

from g in
from c in customers
group c by c.Country
select new { Country = g.Key, CustCount = g.Count() }

the final translation of which is

customers.
GroupBy(c => c.Country).
Select(g => new { Country = g.Key, CustCount = g.Count() })

        1. Explicit range variable types


A from clause that explicitly specifies a range variable type

from T x in e

is translated into

from x in ( e ) . Cast < T > ( )

A join clause that explicitly specifies a range variable type

join T x in e on k1 equals k2

is translated into

join x in ( e ) . Cast < T > ( ) on k1 equals k2

The translations in the following sections assume that queries have no explicit range variable types.

The example

from Customer c in customers
where c.City == "London"
select c

is translated into

from c in customers.Cast()
where c.City == "London"
select c

the final translation of which is

customers.
Cast().
Where(c => c.City == "London")

Explicit range variable types are useful for querying collections that implement the non-generic IEnumerable interface, but not the generic IEnumerable interface. In the example above, this would be the case if customers were of type ArrayList.



        1. Download 0,75 Mb.

          Do'stlaringiz bilan baham:
1   ...   272   273   274   275   276   277   278   279   ...   524




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