c# object distinct code example
Example 1: c# distinct array of objects by values
var uniquePersons = persons.GroupBy(p => p.Email)
.Select(grp => grp.First())
.ToArray();
Example 2: c# distinct dictionary
var temp = _context.PlayerStats.Where(T => T.allianceId == _surf).Select(T => T.guildId).Distinct();
var result = new Dictionary();
foreach (var item in temp)
result[item] = _context.PlayerStats.FirstOrDefault(T => T.guildId == item).guildName;
return View(result);