Search code examples
c#linqgroup-bylinq-group

HOW TO query with linq GROUP BY multiple and SELECT


I already have the following code. But i dont know whats wrong. Why cant i do the group by with the select?

Any idea?

thanks!

lstPendientes = await (from item in db.erProcesaReenvio
                       group item by new
                       {
                           item.iderRegistroCredito,
                           item.cuentaClabe,
                           item.nombreCliente,
                           item.idCtaProcesar,
                           item.No_Cuenta,
                           item.afiliado,
                           item.ImporteCobrar
                       } into g
                       select new {
                           prop1 = g.iderRegistroCredito,
                           prop2 = g.cuentaClabe
                       });

Solution

  • this works for me

    g.Key.iderRegistroCredito