none
Linq Gruping Dynamically RRS feed

  • Question

  • Hi i want to write dynamic Grouping for my code.

                        var categories =
             from p in kk  //KK List.
             group p by new
             {
                 Sec = "GroupColumnName.LastOrDefault().ToString()" //Dyanamic Coluname
             } into g
             select new { Category = g.Key, TotalUnitsInStock = g.Sum(p => p.PO_NetAmount //Dynamic Columnname) };

    how can I achieve this.


    Amitsp

    Friday, April 20, 2012 5:48 AM

Answers