Answers for ".netstandard distinctby iqueryable"

C#
0

.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());
	}
Posted by: Guest on April-15-2020

C# Answers by Framework

Browse Popular Code Answers by Language