Merge branch 'master' of http://github.com/mono/mono
[mono.git] / mcs / errors / cs1579-3.cs
1 // CS1579: foreach statement cannot operate on variables of type `C' because it does not contain a definition for `GetEnumerator' or is inaccessible
2 // Line: 37
3
4 using System;
5
6 public class Enumerator
7 {
8         public bool MoveNext ()
9         {
10                 return false;
11         }
12
13         public int Current { get; set; }
14 }
15
16
17 public class Base
18 {
19         public Enumerator GetEnumerator ()
20         {
21                 return new Enumerator ();
22         }
23 }
24
25 public class C : Base
26 {
27         new internal Enumerator GetEnumerator ()
28         {
29                 return new Enumerator ();
30         }
31 }
32
33 class Test
34 {
35         public static void Main ()
36         {
37                 foreach (var e in new C ())
38                         Console.WriteLine (e);
39         }
40 }