Class MappedComparer<T1, T2>
An equality comparer that applies a mapping to elements before comparing them.
Inheritance
Implements
Inherited Members
Namespace: Flame.Collections
Assembly: Flame.dll
Syntax
public sealed class MappedComparer<T1, T2> : IEqualityComparer<T1>
Type Parameters
Name | Description |
---|---|
T1 | The argument type of the mapping. |
T2 | The return type of the mapping. |
Constructors
| Improve this Doc View SourceMappedComparer(Func<T1, T2>)
Creates an equality comparer that first applies a mapping and then compares the results using the default comparer.
Declaration
public MappedComparer(Func<T1, T2> transform)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T1, T2> | transform | A mapping that takes an element and transforms it before it is compared. |
MappedComparer(Func<T1, T2>, IEqualityComparer<T2>)
Creates an equality comparer that first applies a mapping and then compares the results using a custom comparer.
Declaration
public MappedComparer(Func<T1, T2> transform, IEqualityComparer<T2> resultComparer)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T1, T2> | transform | A mapping that takes an element and transforms it before it is compared. |
System.Collections.Generic.IEqualityComparer<T2> | resultComparer | A comparer for the results of |
Fields
| Improve this Doc View SourceResultComparer
An equality comparer for values of type T2
.
Declaration
public readonly IEqualityComparer<T2> ResultComparer
Field Value
Type | Description |
---|---|
System.Collections.Generic.IEqualityComparer<T2> |
Transform
Takes a value of type T1
and maps it
to a value of type T2
.
Declaration
public readonly Func<T1, T2> Transform
Field Value
Type | Description |
---|---|
System.Func<T1, T2> |
Methods
| Improve this Doc View SourceEquals(T1, T1)
Tests if two values are equal.
Declaration
public bool Equals(T1 x, T1 y)
Parameters
Type | Name | Description |
---|---|---|
T1 | x | The first value to compare. |
T1 | y | The second value to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
GetHashCode(T1)
Computes a hash code for a value.
Declaration
public int GetHashCode(T1 obj)
Parameters
Type | Name | Description |
---|---|---|
T1 | obj | The value to compute a hash code for. |
Returns
Type | Description |
---|---|
System.Int32 | A hash code. |