1 public struct KeyValuePair
<X
,Y
>
3 public KeyValuePair (X x
, Y y
)
7 public interface IComparer
<T
>
12 public class KeyValuePairComparer
<K
,V
> : IComparer
<KeyValuePair
<K
,V
>>
14 public int Compare (KeyValuePair
<K
,V
> a
)
20 public class TreeBag
<T
>
22 IComparer
<T
> comparer
;
25 public TreeBag (IComparer
<T
> comparer
, T item
)
27 this.comparer
= comparer
;
33 return comparer
.Compare (item
);
39 public static void Main ()
41 KeyValuePair
<int,int> pair
= new KeyValuePair
<int,int> (3, 89);
42 KeyValuePairComparer
<int,int> comparer
= new KeyValuePairComparer
<int,int> ();
43 TreeBag
<KeyValuePair
<int,int>> bag
= new TreeBag
<KeyValuePair
<int,int>> (comparer
, pair
);