2005-06-05 Peter Bartok <pbartok@novell.com>
[mono.git] / mcs / tests / gen-111.cs
1 using System;
2
3 public struct KeyValuePair<K,V>
4 {
5         public K key;
6         public V value;
7
8         public KeyValuePair(K k, V v) { key = k; value = v; }
9
10         public KeyValuePair(K k) { key = k; value = default(V); }
11 }
12
13 public class Collection<T>
14 {
15         public readonly T Item;
16
17         public Collection (T item)
18         {
19                 this.Item = item;
20         }
21
22         public void Find (ref T item)
23         {
24                 item = Item;
25         }
26 }
27
28 class X
29 {
30         static int Main ()
31         {
32                 KeyValuePair<int,long> p = new KeyValuePair<int,long> (3);
33                 KeyValuePair<int,long> q = new KeyValuePair<int,long> (5, 9);
34
35                 Collection<KeyValuePair<int,long>> c = new Collection<KeyValuePair<int,long>> (q);
36                 c.Find (ref p);
37
38                 if (p.key != 5)
39                         return 1;
40                 if (p.value != 9)
41                         return 2;
42
43                 return 0;
44         }
45 }