Format:
Recent snippets matching tags of .NET40
public static IEnumerable<TSource> Distinct<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> selector) { return source.Distinct(new SelectorEqualityComparer<TSource, TKey>(selector)); }
85 Views
no comments
public static IEnumerable<TSource> Distinct<TSource>(this IEnumerable<TSource> source, Func<TSource, TSource, bool> predicate) { return source.Distinct(new PredicateEqualityComparer<TSource>(predicate)); }
89 Views
no comments
[Serializable] public class SelectorEqualityComparer<TSource, Tkey> : EqualityComparer<TSource> { private Func<TSource, Tkey> selector; public SelectorEqualityComparer(Func<TSource, Tkey> selector) : base() { this.selector = selector; }
94 Views
no comments
[Serializable] public class PredicateEqualityComparer<T> : EqualityComparer<T> { private Func<T, T, bool> predicate; public PredicateEqualityComparer(Func<T, T, bool> predicate) : base() { this.predicate = predicate; }
61 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
