Take Last Records from duplicate data in List<T>

  • Thread starter Thread starter Sudip_inn
  • Start date Start date
S

Sudip_inn

Guest
This is my code

List<Lineitem> _li = new List<Lineitem>
{

new Lineitem { LiName = "Net Revenue", TabName = "BCC" },
new Lineitem { LiName = "Global Revenue", TabName = "bcf" },
new Lineitem { LiName = "Cost of Revenue", TabName = "AXN" },
new Lineitem { LiName = "Gross Profit-GAAP", TabName = "POL" },
new Lineitem { LiName = "EBITDA", TabName = "BCF" }
};

var groupedCustomerList1 = _li
.GroupBy(u => u.TabName.ToUpper())
.Select(grp => grp.ToList())
.ToList();

OR

var groupedCustomerList3 = _li
.GroupBy(u => u.TabName.ToUpper())
.SelectMany(grp => grp.Skip(1))
.ToList();


BCF appear twice in list<T>. so how could i take last records from the duplicate records. above code not return desired output. thanks

Continue reading...
 
Back
Top