I want to select some fields from DataView
and after selecting those fields want to apply .Distinct() on these set of fields.
Right now, I used this code :
DataView dvGroups = new DataView();
dvGroups = GetDataFromDatabase(); //-- Fill Dataview
var groups = dvGroups.Table.AsEnumerable()
.Where(x => x.Field<int>("GroupId") != 0)
.Select(p => p.Field<int>("GroupId"))
.Distinct()
.ToArray();
it's only selecting a single field (i.e "GroupId"
). But, Now i want to select multiple fields (like "GroupId", "GroupName"
) and then get the distinct value.
How can i achieve this task?