NadekoBot/NadekoBot.Core/_Extensions/IEnumerableExtensions.cs
2017-09-30 00:46:33 +02:00

14 lines
346 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace NadekoBot.Extensions
{
public static class IEnumerableExtensions
{
public static IEnumerable<T> Distinct<T, U>(this IEnumerable<T> data, Func<T, U> getKey) =>
data.GroupBy(x => getKey(x))
.Select(x => x.First());
}
}