Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IEnumerator Reset Error

Status
Not open for further replies.

RoguePoet01

Programmer
Joined
Oct 1, 2003
Messages
302
Location
US
Hi,

I'm new to this and I can't figure it out.

This example was given to me in a book:

using System;
using System.Collections;

// LINKED LIST ENUMERATOR
public class LinkedListEnumerator : IEnumerator {

private _node m_current = null;
private _node m_begin = null;
private bool m_last = false;

public LinkedListEnumerator( _node n ) { m_current = m_begin = n; }

...

}


But when I try to compile the snippit, I get this error:

'LinkedListEnumerator' does not implement interface member 'System.Collections.IEnumerator.Reset()'

Any ideas?

Thanks.
 
Found it:

"IEnumerator is an interface which has three functions MoveNext, Reset and Current and xxx has to implement all of them to remove the compiler errors"


The reset code was missing:

public void Reset() {
m_current = m_begin;
m_last = false;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top