1 // Compiler options: -langversion:default
7 using System
.Collections
;
10 static IEnumerable
GetIt ()
12 List l
= new List (3);
24 foreach (int i
in GetIt ()) {
25 Console
.WriteLine ("Got: " + i
);
29 return total
== 6 ? 0 : 1;
33 public class List
: IEnumerable
{
43 public void Add (int value)
45 items
[pos
++] = value;
48 public MyEnumerator
GetEnumerator ()
50 return new MyEnumerator(this);
53 IEnumerator IEnumerable
.GetEnumerator ()
55 return GetEnumerator ();
58 public struct MyEnumerator
: IEnumerator
{
63 public MyEnumerator (List l
)
69 public object Current
{
75 public bool MoveNext()