Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1084769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:36:16+00:00 2026-05-16T22:36:16+00:00

I have a question about the IEnumerator.GetEnumerator() method. public class NodeFull { public enum

  • 0

I have a question about the IEnumerator.GetEnumerator() method.

public class NodeFull
{
    public enum Base : byte {A = 0, C, G, U };
    private int taxID;
    private List<int> children;

    public int TaxID
    {
        get { return taxID; }
        set { taxID = value; }
    }

    public int this[int i]
    {
        get { return children[i]; }
        set { children[i] = value; }
    }

    public IEnumerator GetEnumerator()
    {
        return (children as IEnumerator).GetEnumerator();
    }

    public TaxNodeFull(int taxID)
    {
        this.taxID = taxID;
        this.children = new List<int>(3);
    }
}

When I try to compile, error message says

‘System.Collections.IEnumerator’ does not contain a definition for ‘GetEnumerator’ and no extension method ‘GetEnumerator’ accepting a first argument of type ‘System.Collections.IEnumerator’ could be found (are you missing a using directive or an assembly reference?)

Is there anything wrong with the code?

Thanks in advance


Thank you guys. I got it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:36:17+00:00Added an answer on May 16, 2026 at 10:36 pm

    It’s IEnumerable.GetEnumerator() (or IEnumerable<T>.GetEnumerator()), not IEnumerator.GetEnumerator(). The members on IEnumerator are MoveNext(), Current and Reset() (and Dispose for the generic version). The IEnumerable is “something that can be iterated over” (e.g. a list) and the IEnumerator represents the current state within that iteration – like a database cursor.

    It’s slightly odd that your class doesn’t implement IEnumerable or IEnumerable<T> itself. I’d expect something like this:

    class NodeFull : IEnumerable<int>
    {
        ... other stuff as normal ...
    
        public IEnumerator<int> GetEnumerator()
        {
            return children.GetEnumerator();
        }
    
        // Use explicit interface implementation as there's a naming
        // clash. This is a standard pattern for implementing IEnumerable<T>.
        IEnumerator IEnumerable.GetEnumerator()
        {
            // Defer to generic version
            return GetEnumerator();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have question about removing element from QList. myclass.h: class node2D : public QObject
I have question about my code which does the Hoare Partition Method. Here is
I have a question about the compliance mode. What happens with my class which
I have a question about how the System class works. Lets say there is
I have a question about enum variable in c++: type enmu { DAY1 =
I have a question about the following code in C++: typedef struct { int
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about XSLT1.0. The task is to write out in HTML all
I have question about normalization. Suppose I have an applications dealing with songs. First

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.