diff options
author | Martin Baulig <martin@novell.com> | 2007-04-11 20:31:13 +0400 |
---|---|---|
committer | Martin Baulig <martin@novell.com> | 2007-04-11 20:31:13 +0400 |
commit | 0e8887028fced6a11044c6848054f7741c2b2691 (patch) | |
tree | eefedc109c9b695d2b2f9531e0d97adc553c3660 /mcs/tests/gtest-330.cs | |
parent | 9c729bc7837845d9faa7b4173086b39252a3660e (diff) |
2007-04-11 Martin Baulig <martin@ximian.com>
* statement.cs (Foreach.CollectionForeach.ProbeCollectionType):
Use `TypeManager.GetInterfaces(t)' rather than `t.GetInterfaces()'
to make this work for generic classes; fixes #79561.
svn path=/trunk/mcs/; revision=75616
Diffstat (limited to 'mcs/tests/gtest-330.cs')
-rwxr-xr-x | mcs/tests/gtest-330.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/mcs/tests/gtest-330.cs b/mcs/tests/gtest-330.cs new file mode 100755 index 00000000000..6c46ea42731 --- /dev/null +++ b/mcs/tests/gtest-330.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +public class BaseCollection<T> : IEnumerable<T> +{ + protected List<T> items = new List<T> (); + + IEnumerator<T> IEnumerable<T>.GetEnumerator () + { + return items.GetEnumerator (); + } + + IEnumerator IEnumerable.GetEnumerator () + { + return items.GetEnumerator (); + } +} + +public class BaseIntList<T> : BaseCollection<T> +{ +} + +public class IntList : BaseIntList<int> +{ +} + +class X +{ + public static void Main () + { + IntList list = new IntList (); + foreach (int i in list) { + Console.WriteLine (i); + } + } +} |