New to Telerik UI for WPFStart a free 30-day trial

A comparer of key-value pairs based on a comparison of the respective keys.

Definition

Namespace:Telerik.Windows.Diagrams.Core

Assembly:Telerik.Windows.Diagrams.Core.dll

Type Parameters:

TKey

The type of the key.

TValue

The type of the value.

Syntax:

C#
public class KeyValuePairComparer<TKey, TValue> : IComparer<KeyValuePair<TKey, TValue>>

Inheritance: objectKeyValuePairComparer<TKey, TValue>

Implements: IComparer<KeyValuePair<TKey, TValue>>

Constructors

Initializes a new instance of the KeyValuePairComparer<TKey, TValue> class.

C#
public KeyValuePairComparer()

Initializes a new instance of the KeyValuePairComparer<TKey, TValue> class.

C#
public KeyValuePairComparer(Comparison<TKey> comparison)
Parameters:comparisonComparison<TKey>

The comparison.

Initializes a new instance of the KeyValuePairComparer<TKey, TValue> class.

C#
public KeyValuePairComparer(IComparer<TKey> comparer)
Parameters:comparerIComparer<TKey>

The comparer.

Methods

Compares the two key pairs.

C#
public int Compare(KeyValuePair<TKey, TValue> x, KeyValuePair<TKey, TValue> y)
Parameters:xKeyValuePair<TKey, TValue>

The x.

yKeyValuePair<TKey, TValue>

The y.

Returns:

int

Implements: IComparer<KeyValuePair<TKey, TValue>>.Compare(KeyValuePair<TKey, TValue>, KeyValuePair<TKey, TValue>)

Compares the two values.

C#
public int Compare(TKey x, TKey y)
Parameters:xTKey

The x.

yTKey

The y.

Returns:

int