|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Agrupar por cláusula (Visual Basic)
Group [ listField1 [, listField2 [...] ] By keyExp1 [, keyExp2 [...] ] Into aggregateList
|
|
|
|
|
|
|
keyExp1 |
|
|
keyExp2 |
|
|
aggregateList |
Into Group Into <alias> = Group |
Public Sub GroupBySample() Dim customers = GetCustomerList() Dim customersByCountry = From cust In customers Order By cust.City Group By CountryName = cust.Country Into RegionalCustomers = Group, Count() Order By CountryName For Each country In customersByCountry Console.WriteLine(country.CountryName & " (" & country.Count & ")" & vbCrLf) For Each customer In country.RegionalCustomers Console.WriteLine(vbTab & customer.CompanyName & " (" & customer.City & ")") Next Next End Sub