svn path=/trunk/mcs/; revision=139107
+2009-07-30 Raja R Harinath <harinath@hurrynot.org>
+
+ * HashSet.cs (Enumerator.CheckCurrent): Inline into ...
+ (Enumerator.IEnumerator.Current): ... this.
+ (Enumerator.IEnumerator.Reset): Check invariants.
+
2009-07-30 Raja R Harinath <harinath@hurrynot.org>
* HashSet.cs (Enumerator.next): Rename from Enumerator.current and
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