linux-packaging-mono/mcs/tests/test-iter-17.cs

25 lines
558 B
C#
Raw Normal View History

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");
}
}