Update mcs/class/System.Core/System/TimeZoneInfo.cs
[mono.git] / mcs / tests / gtest-483.cs
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4
5 class Program
6 {
7         static int Main ()
8         {
9                 Int32Collection src = new Int32Collection ();
10                 Int32Collection dest = new Int32Collection ();
11
12                 src.Add (5);
13                 src.Add (7);
14                 dest.Add (4);
15
16                 ReplaceContentsWith<Int32Collection> (src, dest);
17
18                 if (dest.Count != 2)
19                         return 1;
20                 if (dest[0] != 5)
21                         return 2;
22                 if (dest[1] != 7)
23                         return 3;
24
25                 return 0;
26         }
27
28         private static void ReplaceContentsWith<T> (T src, T dst)
29                 where T : Int32Collection
30         {
31                 dst.Clear ();
32                 foreach (int value in src)
33                         dst.Add (value);
34         }
35 }
36
37 class Int32Collection : IEnumerable
38 {
39         List<int> list = new List<int> ();
40
41         public int Count
42         {
43                 get { return list.Count; }
44         }
45
46         public int this[int index]
47         {
48                 get { return (int) list[index]; }
49                 set { list[index] = value; }
50         }
51
52         public void Add (int value)
53         {
54                 list.Add (value);
55         }
56
57         public void Clear ()
58         {
59                 list.Clear ();
60         }
61
62         IEnumerator IEnumerable.GetEnumerator ()
63         {
64                 return list.GetEnumerator ();
65         }
66 }