Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

.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());
	}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #distinctby #iqueryable
ADD COMMENT
Topic
Name
4+8 =