https://discord.umbraco.com logo
#package-development
Title
# package-development
k

kevinjump

01/31/2022, 2:18 PM
e.g
Copy code
cs
internal static IEnumerable<TSource> SafeDistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
            where TKey : IEquatable<TKey>
{ 
#if NET6_0
  return source.DistinctBy(keySelector);
#else
  return Umbraco.Extensions.EnumerableExtensions.DistinctBy(source, keySelector);
#endif
}