Hello,
This question relates to chapter 5 in the book. I'm getting an error when building the HelloCollection code.
'HelloCollection.Enumerator' does not contain a
constructor that takes '0' arguments
Code:
public class HelloCollection : IEnumerable {
public IEnumerator GetEnumerator() {
Enumerator enumerator = new Enumerator();
return enumerator;
}
public class Enumerator : IEnumerator, IDisposable {
private int state;
private object current;
public Enumerator(int state) {
this.state = state;
}
Clearly, the Enumerator constructor here does require one argument, and clearly the Enumerator is instantiated without passing in an argument. The book shows it this way, and I could not find a code example for this in the downloads. (The download has the HelloCollection that comes first in the book, the second version of it appears to be missing)
Should I be instantiating the Enumerator using a value of say 0?