T
Tony Johansson
Hello!
interface IEnumerable is declared in this way.
public interface IEnumerable<T> : IEnumerable
{
IEnumerator<T> GetEnumerator();
}
Now to my question I can't understand why the generic interface
IEnumerable<T> is implementing
the non generic interface IEnumerable ?
I mean that if I use generics I have no use for implementing public
IEnumerator GetEnumerator()
This mean that any class or struct that implement IEnumerable<T>
must implement these two see below.
public IEnumerator GetEnumerator()
{
....
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
....
}
//Tony
interface IEnumerable is declared in this way.
public interface IEnumerable<T> : IEnumerable
{
IEnumerator<T> GetEnumerator();
}
Now to my question I can't understand why the generic interface
IEnumerable<T> is implementing
the non generic interface IEnumerable ?
I mean that if I use generics I have no use for implementing public
IEnumerator GetEnumerator()
This mean that any class or struct that implement IEnumerable<T>
must implement these two see below.
public IEnumerator GetEnumerator()
{
....
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
....
}
//Tony