c# distinctby iqueryable code example
Example: .netstandard distinctby iqueryable
public static IQueryable<TSource> DistinctBy<TSource, TKey>(
this IQueryable<TSource> source,
Expression<Func<TSource, TKey>> keySelector)
{
return source.GroupBy(keySelector).Select(grouping => grouping.FirstOrDefault());
}