Group a collection and return a Dictionary
How about:
public ILookup<string, PriceDetail> GetGroupedPriceDetails(IEnumerable<PriceDetail> priceDetails)
{
return priceDetails.ToLookup(priceDetail => priceDetail.Code);
}
Can you not do:
priceDetails.GroupBy(priceDetail => priceDetail.Code)
.ToDictionary(group => group.Key, group => group.ToList())