blob: 05f921ddbcc47558a84887311f6c870e411270a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
using System;
using System.Collections.Generic;
class X
{
static int[] x = new int[] {100, 200};
public static int Main ()
{
IEnumerator<int> enumerator = X<int>.Y (x);
int sum = 0;
while (enumerator.MoveNext ())
sum += enumerator.Current;
if (sum != 300)
return 1;
if (X<int>.Z (x, 0) != 100)
return 2;
if (X<int>.Z (x, 1) != 200)
return 3;
return 0;
}
}
class X <T>
{
public static IEnumerator<T> Y (IEnumerable <T> x)
{
return x.GetEnumerator ();
}
public static T Z (IList<T> x, int index)
{
return x [index];
}
}
|