Skip to content

Derive from IEnumerator<T>

George George

Asked May 3, 2008, 5:31 AM EDT2 answers
Share
LinkedInX

Hello everyone,


I am wondering why do we need to derive some type from IEnumerator<T>? Could anyone show me some useful samples?

I think using IEnumerator<T> itself should be enough in all cases?


thanks in advance,
George

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    IEnumerator<T> is a generic IEnumerator interface which allows you to create a generic, enumerator for enumerating through lists :) Ive never used it though...

    Also, its just coding etiquette but you dont technically "derive" from an interface, you implement it. And interface basically says that this certain class (the class that implements it) is guaranteed to have these members. It works nicely in generics, much like a base class, but it does not declare instance members. Meaning you dont have to worry about the base members it contains.
    0
  • 0

    Thanks buddy,

     

    What makes me confused is about how to write the constructor of the class which implements IEnumarator<T>, could you show me a sample please?

     

    regards,
    George

    0