summaryrefslogtreecommitdiff
path: root/mcs/tests/test-iter-17.cs
blob: f31879a65ae2383736ce5d6866858e2c7982177c (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
using System;
using System.Collections;

class Program
{
    static public IEnumerable Empty {
        get {
            object [] os = new object [] { };
            foreach (object o in os) {
                yield return o;
            }
        }
    }

    public static void Main()
    {
        IEnumerator enumerator = Empty.GetEnumerator();
        if (enumerator.Current == null)
            Console.WriteLine("Successful");
        enumerator.MoveNext();
        if (enumerator.Current == null)
            Console.WriteLine("Successful");
    }
}