Error message regarding IEnumerable.GetEnumerator().
- by Bon_chan
I get this error message and I can't figure out why!
Error 1 'Exo5Chap12.ShortCollection<T>' does not implement interface member
'System.Collections.IEnumerable.GetEnumerator()'.
'Exo5Chap12.ShortCollection<T>.GetEnumerator()' cannot implement
'System.Collections.IEnumerable.GetEnumerator()' because it does not have the matching
return type of 'System.Collections.IEnumerator'.
E:\MyFolders\Dev\c#\Chapter12\Exo5Chap12\Exo5Chap12\exo5.cs 9 18 Exo5Chap12
Here is the code with an implementation of GetEnumerator().
What is wrong?
public class ShortCollection<T> : IList<T>
{
protected Collection<T> innerCollection;
protected int maxSize = 10;
public IEnumerator<T> GetEnumerator()
{
return (innerCollection as IEnumerator<T>).GetEnumerator();
}
}