Distinct<TSource>(this IEnumerable<TSource> source, IEqualityComparer<TSource> comparer) code example
Example: C# .NET Core linq Distinct
var distinctUsers = allUsers
.GroupBy(x => x.UserId)
.Select(x => x.First())
.ToList();
var distinctUsers = allUsers
.GroupBy(x => x.UserId)
.Select(x => x.First())
.ToList();