1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 01:38:24 +00:00
Radarr/NzbDrone.Common/IEnumerableExtensions.cs
2013-09-18 18:09:26 -07:00

16 lines
No EOL
441 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace NzbDrone.Common
{
public static class EnumerableExtensions
{
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
{
var knownKeys = new HashSet<TKey>();
return source.Where(element => knownKeys.Add(keySelector(element)));
}
}
}