obsluga IEnumerable

0

witam mam nastepujacy problem:
pisze klase ktora obsluguje interfejs IEnumerable i w/g tego co znalazlem powinna ona miec implementacje metody GetEnumerator() wyglada to tak:

namespace spony
{

class do_dodania : IEnumerable<int>
{
    int[] dana;
    public do_dodania(params int[] wsk)
    {
        dana = new int[wsk.Length];

        int i = 0;
        foreach (int s in wsk)
        {
            dana[i++] = s;
        }
    }

    public IEnumerator<int> GetEnumerator()
    {
        foreach (int s in dana)
        {
            yield return s;
        }
    }
}

}

jednak kompilator wywala mi blad:

"spony.do_dodania' does not implement interface member 'SYSTEM.Collections.IEnumerable.GetEnumerator()'. 'spony.do_dodania.GetEnumerator() is either static, not public, or has the wrong return type."

nie rozumiem ? GetEnumerator jest publiczne przeceiz, definicja tej metody jest taka jak przyklad w ksiazce C# Programowanie Jesse Liberty i nie wiem czemu to nie dziala ? korzystam z VS 2005 czyli C# 2.0 a ksiazka jest tez jest do C# 2.0 prosze o pomoc!

0

temat jest stary, ale moze komu innemu sie przyda:
http://www.coding-portal.com/viewthread.php?tid=348

1 użytkowników online, w tym zalogowanych: 0, gości: 1