Incorrect return statement position (Chapter 15)
The example for default interface methods has return count; outside the
declaration of the Count() method. It should instead be inside the using statement
in that method. So the code should be:
public interface IEnumerable<T>
{
IEnumerator<T> GetEnumerator();
int Count()
{
using (var iterator = GetEnumerator())
{
int count = 0;
while (iterator.MoveNext())
{
count++;
}
return count;
}
}
}
All errata
