i return such type IQueryable< IGrouping<int, Invoice>> List()
how can i work with it? like with generic List<Invoice>
?
views:
403answers:
1
+2
A:
No, you have a IGrouping<int, Invoice>
as your list member.
Each grouping has a Key
property allowing you access to the key of the group and an IEnumerable<Invoice>
containing the grouped Invoices.
So to access it ...
IQueryable< IGrouping<int, Invoice>> List() groupedIvoices = //... get your grouping
foreach (var group in groupedIvoices ) {
var key = group.Key;
var invoicesInGroup = group.ToList();
}
Look at 101 Linq Samples for samples and explanations for the different Linq functions.
Obalix
2010-03-19 08:24:19
can you show sample of code?
kusanagi
2010-03-19 08:31:16
@user276640: Was writing it while you commented :-)
Obalix
2010-03-19 08:36:13