kiamlaluno
3
Q:

c# linq select only unique values from list

If your requirements are to have no duplicates, you should be using a HashSet.
HashSet.Add will return false when the item already exists (if that even matters to you).
0
var uniq = allvalues.GroupBy(x => x.Id).Select(y=>y.First()).Distinct();
0
var uniqueCategories =  repository.GetAllProducts()
                                  .Select(p=>p.Category)
                                  .Distinct();
0

New to Communities?

Join the community