2010-02-19 Rodrigo Kumpera <rkumpera@novell.com>
[mcs.git] / tests / gtest-181.cs
blobb2ad3c8bf78fd043e819db751128c406e03699e1
1 using System;
2 using System.Collections;
4 class X {
5 static IEnumerator GetIt
7 get {
8 yield return 1;
9 yield return 2;
10 yield return 3;
12 set
17 IEnumerable this [int i]
19 get {
20 yield return 1*i;
21 yield return 2*i;
22 yield return 3*i;
24 set
29 static int Main ()
31 IEnumerator e = GetIt;
32 int total = 0;
34 while (e.MoveNext ()){
35 Console.WriteLine ("Value=" + e.Current);
36 total += (int) e.Current;
39 if (total != 6)
40 return 1;
42 total = 0;
43 X x = new X ();
44 foreach (int i in x [2]){
45 Console.WriteLine ("Value=" + i);
46 total += i;
48 if (total != 12)
49 return 2;
51 return 0;