Class KeyValuePairComparer<TKey, TValue>
Vanilla key-based comparer for
Inheritance
System.Object
KeyValuePairComparer<TKey, TValue>
Implements
IComparer<TKey>
Namespace: ISynergy.Framework.Core.Collections
Assembly: ISynergy.Framework.Core.dll
Syntax
public class KeyValuePairComparer<TKey, TValue> : Comparer<KeyValuePair<TKey, TValue>>
Type Parameters
Name | Description |
---|---|
TKey | The key type in the key-value pair. |
TValue | The value type in the key-value pair. |
Constructors
View SourceKeyValuePairComparer()
Initializes a new instance of the KeyValuePairComparer<TKey, TValue> class.
Declaration
public KeyValuePairComparer()
KeyValuePairComparer(IComparer<TKey>)
Initializes a new instance of the KeyValuePairComparer<TKey, TValue> class.
Declaration
public KeyValuePairComparer(IComparer<TKey> keyComparer)
Parameters
Type | Name | Description |
---|---|---|
IComparer<TKey> | keyComparer | The comparer to be used to compare keys. |
Properties
View SourceDefault
Returns a default sort order comparer for the key-value pair specified by the generic argument.
Declaration
public static KeyValuePairComparer<TKey, TValue> Default { get; }
Property Value
Type | Description |
---|---|
KeyValuePairComparer<TKey, TValue> |
Methods
View SourceCompare(TKey, TKey)
Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
Declaration
public int Compare(TKey x, TKey y)
Parameters
Type | Name | Description |
---|---|---|
TKey | x | The first object to compare. |
TKey | y | The second object to compare. |
Returns
Type | Description |
---|---|
System.Int32 |
Compare(KeyValuePair<TKey, TValue>, KeyValuePair<TKey, TValue>)
Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
Declaration
public override int Compare(KeyValuePair<TKey, TValue> x, KeyValuePair<TKey, TValue> y)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<TKey, TValue> | x | The first object to compare. |
KeyValuePair<TKey, TValue> | y | The second object to compare. |
Returns
Type | Description |
---|---|
System.Int32 |
Implements
IComparer<>