vendredi 20 novembre 2015

Remove duplicate objects based on a list properties

I want to distinct a list of objects just based on some properties. These properties are gotten via reflection and some conditions. I searched a lot but cannot found any code snippets or solutions that are able to do a loop in this lambda expression.

List<PropertyInfo> propList = ... 
var distinctList = FullList
  .GroupBy(uniqueObj => 
  { 
  //do a loop to iterate all elements in propList 
  })
  .Select(x => x.First());





Aucun commentaire:

Enregistrer un commentaire