[Mono-bugs] [Bug 572053] foreach over a System.Collection.Generic.Dictionary<K, T> derived class throws CS0030 compilation error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jan 19 16:32:08 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=572053

http://bugzilla.novell.com/show_bug.cgi?id=572053#c1


--- Comment #1 from Michael Cummings <cummings.michael at gmail.com> 2010-01-19 21:32:07 UTC ---
The code smaple above actually doesn't compile in .Net either, however, this
one does, and throws the compiler error in Mono.

using System;
using System.Collections;
using System.Collections.Generic;

namespace MonoGenericIteratorTest
{
    public class MyType
    {

    }

    public abstract class MyCollectionBase<T> : Dictionary<string, T>
    {
        public new virtual IEnumerator GetEnumerator()
        {
            return Values.GetEnumerator();
        }

    }

    public class MyCollection : MyCollectionBase<MyType>
    {

    }

    class MainClass
    {
        public static void Main(string[] args)
        {
            MyCollection myCollection = new MyCollection();

            foreach (MyType item in myCollection) {
                Console.WriteLine("Success.");
            }
        }
    }
}

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list