summaryrefslogtreecommitdiff
path: root/mcs/tests/gtest-114.cs
blob: 01fcf1e56ab5248a975321cba8622017a272c67a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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);
	}
}