summaryrefslogtreecommitdiff
path: root/mcs/errors/cs1579-2.cs
blob: 93ae2c1e76a6b39f691942cc386aa839c3c16a0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Cs1579: foreach statement cannot operate on variables of type `Foo' because it does not contain a definition for `GetEnumerator' or is inaccessible
// Line: 12

using System;
using System.Collections;

public class Test
{
        public static void Main ()
        {
                Foo f = new Foo ();
                foreach (object o in f)
                        Console.WriteLine (o);
        }
}

public class Foo
{
        internal IEnumerator GetEnumerator ()
        {
                return new ArrayList ().GetEnumerator ();
        }
}