2009-02-10 Jeffrey Stedfast <fejj@novell.com>
[mono-project/dkf.git] / mcs / tests / gtest-308.cs
blobce8ffec8a4837d3832f2f812d55d18b97a04b201
1 using System;
3 public class Test {
4 public static Comparison<U> WrapComparison<U>(Comparison<U> comparison)
6 return delegate(U x, U y) { return comparison(x, y); };
9 public delegate int MyComparison<V> (V x, V y);
10 public static MyComparison<W> WrapMyComparison<W>(MyComparison<W> myComparison)
12 return delegate(W x, W y) { return myComparison(x, y); };
16 public class Foo {
17 static int compare (int x, int y)
18 { return x - y; }
19 static int compare (string x, string y)
20 { return string.Compare (x, y); }
21 static void test (int i)
23 if (i != 0)
24 throw new Exception (""+i);
26 static void Main ()
28 Comparison<int> ci = Test.WrapComparison<int> (compare);
29 Comparison<string> cs = Test.WrapComparison<string> (compare);
30 Test.MyComparison<int> mci = Test.WrapMyComparison<int> (compare);
31 Test.MyComparison<string> mcs = Test.WrapMyComparison<string> (compare);
32 test (ci (1,1));
33 test (cs ("h", "h"));
34 test (mci (2,2));
35 test (mcs ("g", "g"));