Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

36 lines
520 B
C#

using System;
using System.Collections.Generic;
public class NaturalComparer<T> : IComparer<T>
where T: IComparable<T>
{
public int Compare (T a, T b)
{
return a.CompareTo (b);
}
}
public class X
{
class Test : IComparable<Test>
{
public int CompareTo (Test that)
{
return 0;
}
public bool Equals (Test that)
{
return false;
}
}
public static void Main ()
{
IComparer<Test> cmp = new NaturalComparer<Test> ();
Test a = new Test ();
Test b = new Test ();
cmp.Compare (a, b);
}
}