[asp.net] Added code to handle local resources copying in the test suite
[mono.git] / mcs / class / Mono.C5 / UserGuideExamples / TestSortedArray.cs
1 // C5 example: This should fail because C5 does not know how to build
2 // a comparer for Object.
3
4 // Similarly for Rec<string,int>
5
6 // Compile with 
7 //   csc /r:C5.dll TestSortedArray.cs 
8
9 using System;
10 using C5;
11 using SCG = System.Collections.Generic;
12
13 namespace TestSortedArray {
14   class TestSortedArray {
15     public static void Main(String[] args) {
16       //       SortedArray<Object> sarr = new SortedArray<Object>();
17       SCG.IComparer<Rec<string,int>> lexico =
18         new DelegateComparer<Rec<string,int>>(
19             delegate(Rec<string,int> r1, Rec<string,int> r2) { 
20               int order = r1.X1.CompareTo(r2.X1);
21               return order==0 ? r1.X2.CompareTo(r2.X2) : order;
22             });
23       SortedArray<Rec<string,int>> sarr = new SortedArray<Rec<string,int>>(lexico);
24       sarr.Add(new Rec<string,int>("ole", 32));
25       sarr.Add(new Rec<string,int>("hans", 77));
26       sarr.Add(new Rec<string,int>("ole", 63));
27       foreach (Rec<string,int> r in sarr)
28         Console.WriteLine(r);
29     }
30   }
31 }