Linq : filter duplicated line without taking account a column
This question already has an answer here:
Try this
var filteredData = data.GroupBy( d=> d.Name).SelectMany(grouping => grouping.First());
Depending upon LinqProvider for the database (IQueryable implementation), The query may run on database, or on client side( if so, there will be memory/network bandwidth issues).
In some case, not all Linq constructs are supported.
Try:
datatable.GroupBy(x => x.Name);
you need to add a using for the System.Linq
namespace.
上一篇: CSV字符串处理
下一篇: Linq:过滤重复的行而不考虑列