Let’s say that you have a list of objects that contains duplicate items and you want to extract a subset of distinct items. Just follow this code.
Happy Programming!!
Just because I can…
var TeamList = _context.tbl_user.ToList();// _context is a entity connection string TeamList = TeamList.GroupBy(i => i.Team).Select(g => g.First()).ToList(); // OR var distinctItems = items.GroupBy(x => x.PropertyToCompare).Select(x => x.First());
Happy Programming!!
Just because I can…
No comments:
Post a Comment