object IEnumerator.Current {
get {
- CheckCurrent ();
+ CheckState ();
+ if (next <= 0)
+ throw new InvalidOperationException ("Current is not valid");
return current;
}
}
void IEnumerator.Reset ()
{
+ CheckState ();
next = 0;
}
if (hashset.generation != stamp)
throw new InvalidOperationException ("HashSet have been modified while it was iterated over");
}
-
- void CheckCurrent ()
- {
- CheckState ();
-
- if (next <= 0)
- throw new InvalidOperationException ("Current is not valid");
- }
}
// borrowed from System.Collections.HashTable