CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of .NET4
XML
<?xml version="1.0"?>
<configuration>
 
  <system.web>
    <compilation debug="false" targetFramework="4.0" />
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <system.serviceModel>
by tonyv   September 18, 2010 @ 11:06pm
Tags: JsonP, WCF, .NET4
665 Views
no comments
 
C#
public static IEnumerable<TSource> Distinct<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> selector)
{
    return source.Distinct(new SelectorEqualityComparer<TSource, TKey>(selector));
}
by Paulo Morgado   April 10, 2010 @ 5:22am
274 Views
no comments
 
C#
public static IEnumerable<TSource> Distinct<TSource>(this IEnumerable<TSource> source, Func<TSource, TSource, bool> predicate)
{
    return source.Distinct(new PredicateEqualityComparer<TSource>(predicate));
}
by Paulo Morgado   April 10, 2010 @ 5:21am
310 Views
no comments
 
C#
[Serializable]
public class SelectorEqualityComparer<TSource, Tkey> : EqualityComparer<TSource>
{
    private Func<TSource, Tkey> selector;
 
    public SelectorEqualityComparer(Func<TSource, Tkey> selector)
        : base()
    {
        this.selector = selector;
    }
by Paulo Morgado   April 10, 2010 @ 5:18am
Tags: C#, .NET, .NET35, .NET40
322 Views
no comments
 
C#
[Serializable]
public class PredicateEqualityComparer<T> : EqualityComparer<T>
{
    private Func<T, T, bool> predicate;
 
    public PredicateEqualityComparer(Func<T, T, bool> predicate)
        : base()
    {
        this.predicate = predicate;
    }
by Paulo Morgado   April 10, 2010 @ 5:12am
Tags: C#, .NET, .NET35, .NET40
284 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate