I am implementing a class that basicaly wraps an array:
public abstract class IndividualBase : IEnumerable<Gene>
{
private readonly Gene[] genoma;
...
public IEnumerator<Gene> GetEnumerator()
{
return genoma.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return genoma.GetEnumerator();
}
}
The problem is that it's giving me trouble with the first GetEnumerator()
-- it tells me that
Cannot implicitly convert type 'System.Collections.IEnumerator' to 'System.Collections.Generic.IEnumerator'. An explicit conversion exists (are you missing a cast?)
Although I understand what the problem is, I have absolutely no idea how to fix it. Anyone?
Thanks