网上演练
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
820 B

#if FAT
using System.Collections.Generic;
namespace LinqInternal.Collections
{
internal class KeyValuePairComparer<TKey, TValue> : IComparer<KeyValuePair<TKey, TValue>>
{
private readonly IComparer<TKey> _keyComparer;
private readonly IComparer<TValue> _valueComparer;
public KeyValuePairComparer(IComparer<TKey> keyComparer, IComparer<TValue> valueComparer)
{
_keyComparer = keyComparer ?? Comparer<TKey>.Default;
_valueComparer = valueComparer ?? Comparer<TValue>.Default;
}
public int Compare(KeyValuePair<TKey, TValue> x, KeyValuePair<TKey, TValue> y)
{
var result = _keyComparer.Compare(x.Key, y.Key);
return result == 0 ? _valueComparer.Compare(x.Value, y.Value) : result;
}
}
}
#endif