コード例 #1
0
        public static IEnumerable <T> DistinctBy <T, TKey>(this IEnumerable <T> items, Func <T, TKey> property)
        {
            GeneralPropertyComparer <T, TKey> comparer = new GeneralPropertyComparer <T, TKey>(property);

            return(items.Distinct(comparer));
        }
コード例 #2
0
        public static IEnumerable <TSource> DistinctBy <TSource, TKey>(this IEnumerable <TSource> source, Func <TSource, TKey> keySelector)
        {
            var comparer = new GeneralPropertyComparer <TSource, TKey>(keySelector);

            return(source.Distinct(comparer));
        }