summaryrefslogtreecommitdiff
path: root/mcs/tests/gtest-iter-13.cs
blob: de07d15ee813a6906b7ac3d8eb9a4b95402abfd1 (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
25
26
27
using System;
using System.Collections;
using System.Collections.Generic;

class C<T>
{
	public IEnumerator GetEnumerator ()
	{
		return new T[0].GetEnumerator ();
	}

	public IEnumerable<T> Filter (Func<T, bool> predicate)
	{
		foreach (T item in this)
			if (predicate (item))
				yield return item;
	}
}

class M
{
	public static void Main ()
	{
		foreach (var v in new C<long>().Filter(null)) {
		}
	}
}