projects
/
mono.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
2002-02-25 Ravi Pratap <ravi@ximian.com>
[mono.git]
/
mcs
/
tests
/
test-36.cs
1
//
2
// This program excercises invoking foreach on structures
3
// that implement GetEnumerator
4
//
5
6
using System;
7
using System.Collections;
8
struct X {
9
int [] a;
10
11
public IEnumerator GetEnumerator ()
12
{
13
a = new int [3] { 1, 2, 3};
14
return a.GetEnumerator ();
15
}
16
}
17
18
class Y {
19
static X x;
20
21
static int Main ()
22
{
23
int total = 0;
24
x = new X ();
25
26
foreach (object a in x){
27
total += (int) a;
28
}
29
30
if (total != 6)
31
return 1;
32
return 0;
33
}
34
}
35