private DataTable RemoveDuplicatesRecords(DataTable dt)
{
//var UniqueRows = dtS.AsEnumerable().Distinct(DataRowComparer.Default);
//DataTable dt2 = UniqueRows.CopyToDataTable();
//return dt2;
var UniqueRows = dt.AsEnumerable()
.GroupBy(x => x.Field<string>("Station"))
.Select(g => g.First());
DataTable dt2 = UniqueRows.CopyToDataTable();
return dt2;
}
{
//var UniqueRows = dtS.AsEnumerable().Distinct(DataRowComparer.Default);
//DataTable dt2 = UniqueRows.CopyToDataTable();
//return dt2;
var UniqueRows = dt.AsEnumerable()
.GroupBy(x => x.Field<string>("Station"))
.Select(g => g.First());
DataTable dt2 = UniqueRows.CopyToDataTable();
return dt2;
}
No comments:
Post a Comment