When you call GroupBy, usually you get a series of groups
IEnumerable<IGrouping<key, IEnumerable<T>>>
where each Grouping has a Key used to create the group
Also has an IEnumerable<t> of whatever items are there in your original data set.
e.g.
we have a customer class with Name, number of order and number of products
CustomerInfo(name, ordersCount, productsCount)
sample data
joe 1 5
jane 4 9
john 2 8
jim 3 1
jean 1 3
jill 2 5
jeb 3 3
jenn 4 7
foreach(var item in data.GroupBy(i => i.OrdersCount)
.Select(group => new {
Key = group.Key,
Count = group.Count()
}).OrderBy(x => x.OrdersCount)
{
Console.WriteLine($"Key : {item.Key} Count : {item.Count}");
}
(Group 1): [joe 1 5, jean 1 3]
(Group 2): [john 2 8, jill 2 5]
(Group 3): [jim 3 1, jeb 3 3]
(Group 4): [jane 4 9, jenn 4 7]
In your case you're setting two keys to identify the record like a composite key
group pl by new
{
pl.Size,
pl.Colour
}
that's the reason your key look like this
Key = { Size = "18 ZOLL", Colour = "ACTION" }
So it depends on the structure & data that you're trying to group by, accordingly you'll have a key and subset
IEnumerable<T>
of super set of that data.
I hope it'll clear your doubts :)