posts - 315, comments - 268, trackbacks - 15

My Links

News

View Pietro Libro's profile on LinkedIn

DomusDotNet
   DomusDotNet

Pietro Libro

Tag Cloud

Article Categories

Archives

Post Categories

Blogs amici

Links

ThenBy

There are 1 entries for the tag ThenBy
Linq: ThenBy e ThenByDescending

Se abbiamo la necessità di ordinare una query Linq per più campi possiamo utilizzare gli operatori ThenBy e ThenByDescending. Considerando le classi del post precedente, se volessimo ordinare  la query: 1 var query1 = esamiSostenuti 2 .OrderBy(es => es.ID_Studente) 3 .Select(es => new { es.ID_Studente, es.Voto }); non solo per il campo ID_Studente, ma anche per il campo Voto, possiamo scrivere: 1 //Ordinamento Ascendente 2 var query2 = esamiSostenuti 3 .OrderBy(es => es.ID_Studente) 4 .ThenBy(es => es.Voto) ...

posted @ venerdì 16 maggio 2008 09:49 | Feedback (0) | Filed Under [ LINQ ]

Powered by:
Powered By Subtext Powered By ASP.NET