I am trying to do a Group By on an IEnumerable. However whenever I try to complete, I keep getting an error.
Dim query As IEnumerable(Of CreditItem) = _
From credits In unprocessedCredits _
Group credits By unprocessedCreditsGrouped = _
New With {Key .Make = credits.Make, _
Key .Part = credits.PartNumber, _
Key .CustomerNumber = credits.CustomerNumber, _
Key .OrderNumber = credits.OrderNumber} _
Into Group _
Select New CreditItem With { _
.Make = unprocessedCreditsGrouped.Make, _
.Part = unprocessedCreditsGrouped.PartNumber, _
.CustomerNumber = unprocessedCreditsGrouped.CustomerNumber, _
.OrderNumber = unprocessedCreditsGrouped.OrderNumber _
})
I need to Group By multiple properties, for example by make, partnumber, customernumber. Also unprocessedCredits also contains the field "quantity" which i will need to get the sum of quantity based on the group by clause. Select New CreditItem is not working. getting some Argument not specified for specified parameter.
However, I don't know if i really need the select statement because i really want to select everything in this ienumerable.
Not just those properties, but i don't think that's possible with group by?
You can create a
CreditItem
directly as grouping variable: