Merge pull request #487 from mayerwin/patch-1
[mono.git] / mcs / tests / gtest-177.cs
1 using System;
2 using System.Collections.Generic;
3
4 class X
5 {
6         static int[] x = new int[] {100, 200};
7
8         public static int Main ()
9         {
10                 IEnumerator<int> enumerator = X<int>.Y (x);
11                 int sum = 0;
12                 while (enumerator.MoveNext ())
13                         sum += enumerator.Current;
14
15                 if (sum != 300)
16                         return 1;
17
18                 if (X<int>.Z (x, 0) != 100)
19                         return 2;
20
21                 if (X<int>.Z (x, 1) != 200)
22                         return 3;
23
24                 return 0;
25         }
26 }
27
28 class X <T>
29 {
30         public static IEnumerator<T> Y (IEnumerable <T> x)
31         {
32                 return x.GetEnumerator ();
33         }
34
35         public static T Z (IList<T> x, int index)
36         {
37                 return x [index];
38         }
39 }