[Mono-bugs] [Bug 409030] gmcs: error CS1579 foreach on TableLayoutStyleCollection

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jul 20 15:08:11 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=409030

User gert.driesen at pandora.be added comment
https://bugzilla.novell.com/show_bug.cgi?id=409030#c1


Gert Driesen <gert.driesen at pandora.be> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |gert.driesen at pandora.be




--- Comment #1 from Gert Driesen <gert.driesen at pandora.be>  2008-07-20 13:08:08 MDT ---
gmcs does not find the explicit interface implementation of IEnumerable.

self-contained testcase:

using System;
using System.Collections;

class Program
{
        static int Main ()
        {
                Int32Collection src = new Int32Collection ();
                Int32Collection dest = new Int32Collection ();

                src.Add (5);
                src.Add (7);
                dest.Add (4);

                ReplaceContentsWith<Int32Collection> (src, dest);

                if (dest.Count != 2)
                        return 1;
                if (dest [0] != 5)
                        return 2;
                if (dest [1] != 7)
                        return 3;

                return 0;
        }

        private static void ReplaceContentsWith<T> (T src, T dst)
                where T : Int32Collection
        {
                dst.Clear ();
                foreach (int value in src)
                        dst.Add (value);
        }
}

class Int32Collection : IEnumerable
{
        ArrayList list = new ArrayList ();

        public int Count {
                get { return list.Count; }
        }

        public int this [int index] {
                get { return (int) list [index]; }
                set { list [index] = value; }
        }

        public void Add (int value)
        {
                list.Add (value);
        }

        public void Clear ()
        {
                list.Clear ();
        }

        IEnumerator IEnumerable.GetEnumerator ()
        {
                return list.GetEnumerator ();
        }
}


-- 
Configure bugmail: https://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