网上演练
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.

39 lines
929 B

// Needed for Workaround
#if !NET_4_6
using System;
using System.Collections.Generic;
using LinqInternal.Core;
namespace LinqInternal.Collections.Specialized
{
[System.Diagnostics.DebuggerNonUserCode]
internal class CustomComparer<T> : IComparer<T>
{
private readonly Func<T, T, int> _comparison;
public CustomComparer(Func<T, T, int> comparison)
{
if (comparison == null)
{
throw new ArgumentNullException("comparison");
}
_comparison = comparison;
}
public CustomComparer(Comparison<T> comparison)
{
if (comparison == null)
{
throw new ArgumentNullException("comparison");
}
_comparison = comparison.Invoke;
}
public int Compare(T x, T y)
{
return _comparison.Invoke(x, y);
}
}
}
#endif