[ https://issues.apache.org/jira/browse/LUCENENET-97?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523727 ] Jon Palmer commented on LUCENENET-97: ------------------------------------- Right in that usage it clearly works but that entirely broken and not the correct implementation of IEnumerator: http://msdn2.microsoft.com/en-us/library/system.collections.ienumerator_members.aspx it going to create weird issues if I use it like this HitIterator iterator = (HitIterator)hits.Iterator(); MessageBox.Show(iterator.Length().ToString()); while (iterator.MoveNext()) { Hit h = (Hit)iterator.Current; MessageBox.Show(h.Get("field")); SomeOtherMethod(iterator); iterator.MoveNext(); } Now the IEnumerator contract says the SomeOtherMethod should be able to call iterator.Current as many times as it wants without any affect. With the existing broken implementation you are force only to every call Current once. Btw the Lucene.Net.Search.Hits should clearly implement IEnumerable by implementing the interface with the simple method: public IEnumerator GetEnumerator() { return Iterator(); } then you can do nice replace the ugly while loop above with nice .net things like this: foreach(Hit h in hits) { MessageBox.Show(h.Get("field")); SomeOtherMethod(h); } > HitIterator does not correctly implement System.Collections.IEnumerator > ----------------------------------------------------------------------- > > Key: LUCENENET-97 > URL: https://issues.apache.org/jira/browse/LUCENENET-97 > Project: Lucene.Net > Issue Type: Bug > Environment: .NET > Reporter: Neal Granroth > > method MoveNext() is supposed to increment the position within the list; it does not. > method Current() is supposed to return the object at the current position, but not change the position within the list. > It incorrectly moves to the next position. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.