I am trying to perform Join, GroupBy two columns and select to a new list as
var v = master.Join(
detail,
o => o.Id,
d => d.OrderId,
(o, d) => new
{
DateAdded = o.DateAdded,
VatRate = d.VatRatePercentage,
InvoiceDescription = o.InvoiceDescription
}).GroupBy(c => new
{
c.DateAdded,
c.VatRate
})
.Select(gcs => new
{
DateAdded = gcs.Key.DateAdded.Date,
VatRate = gcs.Key.VatRate,
InvoiceTypeDescription = gcs.Key.InvoiceDescription,
}
).ToList();
but i get the error
'<anonymous type: DateTime DateAdded, decimal VatRate>' does not contain a definition for 'InvoiceTypeDescription' and no accessible extension method 'InvoiceTypeDescription' accepting a first argument of type '<anonymous type: DateTime DateAdded, decimal VatRate>' could be found
I would like to group by two columns (DateAdded, VatRate) but get the InvoiceDescription column also in the results. How can i fix that?