Show / Hide Table of Contents

    Class DynamicEqualityComparer

    Provides a factory based way to create and wrap an System.Collections.Generic.IEqualityComparer<T> implementation.

    Inheritance
    System.Object
    DynamicEqualityComparer
    Namespace: Cuemon.Collections.Generic
    Assembly: Cuemon.Core.dll
    Syntax
    public static class DynamicEqualityComparer

    Methods

    | Improve this Doc

    Create<T>(Func<T, Int32>, Func<T, T, Boolean>)

    Creates a dynamic instance of an System.Collections.Generic.IEqualityComparer<T> implementation wrapping System.Collections.Generic.IEqualityComparer<T>.GetHashCode(T) through hashCalculator and System.Collections.Generic.IEqualityComparer<T>.Equals(T, T). through equalityComparer.

    Declaration
    public static IEqualityComparer<T> Create<T>(Func<T, int> hashCalculator, Func<T, T, bool> equalityComparer)
    Parameters
    Type Name Description
    System.Func<T, System.Int32> hashCalculator

    The function delegate that calculates a hash code of the specified object and is invoked first.

    System.Func<T, T, System.Boolean> equalityComparer

    The function delegate that determines whether the specified objects are equal. This delegate is invoked second if qualified.

    Returns
    Type Description
    System.Collections.Generic.IEqualityComparer<T>

    A dynamic instance of System.Collections.Generic.IEqualityComparer<T> for type T.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Remarks

    The function delegate, hashCalculator (System.Collections.Generic.IEqualityComparer<T>.GetHashCode(T)), is evaluated with a conditional-AND before the second function delegate, equalityComparer (System.Collections.Generic.IEqualityComparer<T>.Equals(T, T)), is ivoked.

    • Improve this Doc
    • View Source
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX