Class LambdaEqualityComparer<T>
An IEqualityComparer that uses a lambda expression for comparing two instances.
Inheritance
System.Object
LambdaEqualityComparer<T>
Implements
System.Collections.Generic.IEqualityComparer<T>
Namespace: ImageVault.Common.Lib
Assembly: ImageVault.Common.dll
Syntax
public class LambdaEqualityComparer<T> : Object
Type Parameters
Name | Description |
---|---|
T |
Constructors
LambdaEqualityComparer(Func<T, T, Boolean>, Func<T, Int32>)
Initializes a new instance of the LambdaEqualityComparer<T> class.
Declaration
public LambdaEqualityComparer(Func<T, T, bool> comparer, Func<T, int> hashMethod)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, T, System.Boolean> | comparer | |
System.Func<T, System.Int32> | hashMethod |
LambdaEqualityComparer(Func<T, Int32>)
Initializes a new instance of the LambdaEqualityComparer<T> class.
Declaration
public LambdaEqualityComparer(Func<T, int> hashMethod)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, System.Int32> | hashMethod | If this function returns the same integer for two instances, then those instances are considered equal. |
Methods
Equals(T, T)
Determines whether the specified objects are equal.
Declaration
public bool Equals(T x, T y)
Parameters
Type | Name | Description |
---|---|---|
T | x | The first object of type |
T | y | The second object of type |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified objects are equal; otherwise, false. |
GetHashCode(T)
Returns a hash code for the specified object.
Declaration
public int GetHashCode(T obj)
Parameters
Type | Name | Description |
---|---|---|
T | obj | The System.Object for which a hash code is to be returned. |
Returns
Type | Description |
---|---|
System.Int32 | A hash code for the specified object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The type of |
Implements
System.Collections.Generic.IEqualityComparer<>