I’ve datatable like:
Group Item
1 1
1 2
2 3
2 4
I need a linq select to get as output:
IEnumerable<Group>, where
class Group
{
IEnumerable<Item> Items;
}
Is that possible with one expression?
Thanks!
upd: LINQ-to-objects (I have datatable)
Since you have a
DataTableobject that does not implement the LINQ interfaces, I suggest you first cast them to something more “objecty” and than use LINQ to extract the data.Something along the lines of:
I assume that the
Groupclass has aGroupIDproperty for the group value.