public static IEnumerable<T> DistinctBy<T, TKey>(this IEnumerable<T> items, Func<T, TKey> property)
return items.GroupBy(property).Select(x => x.First());
.net, C#, distinct, distinctby, linq
This entry was posted on September 18, 2015, 11:41 pm and is filed under C#. You can follow any responses to this entry through RSS 2.0.
You can leave a response, or trackback from your own site.
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of new comments via email.
Sitecore Technology MVP 2016, 2017
Enter your email address to follow this blog and receive notifications of new posts by email.
Create a free website or blog at WordPress.com.