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.
37 lines
959 B
37 lines
959 B
#if FAT |
|
|
|
using System; |
|
using System.Collections.Generic; |
|
|
|
using LinqInternal.Core; |
|
|
|
namespace LinqInternal.Collections.Specialized |
|
{ |
|
[System.Diagnostics.DebuggerNonUserCode] |
|
internal class ConversionComparer<TInput, TOutput> : IComparer<TInput> |
|
{ |
|
private readonly IComparer<TOutput> _comparer; |
|
private readonly Func<TInput, TOutput> _converter; |
|
|
|
public ConversionComparer(IComparer<TOutput> comparer, Func<TInput, TOutput> converter) |
|
{ |
|
if (comparer == null) |
|
{ |
|
throw new ArgumentNullException("comparer"); |
|
} |
|
_comparer = comparer; |
|
if (converter == null) |
|
{ |
|
throw new ArgumentNullException("converter"); |
|
} |
|
_converter = converter; |
|
} |
|
|
|
public int Compare(TInput x, TInput y) |
|
{ |
|
return _comparer.Compare(_converter(x), _converter(y)); |
|
} |
|
} |
|
} |
|
|
|
#endif |