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 763699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:36:17+00:00 2026-05-14T16:36:17+00:00

I was implementing my own ArrayList class and was left surprised when I realised

  • 0

I was implementing my own ArrayList class and was left surprised when I realised that

public System.Collections.Generic.IEnumerator<T> GetEnumerator() {
    return _array.GetEnumerator();
}

didn’t work. What is the reason arrays don’t implement IEnumerator in .NET?

Is there any work-around?

Thanks

  • 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-14T16:36:17+00:00Added an answer on May 14, 2026 at 4:36 pm

    Arrays do implement IEnumerable<T>, but it is done as part of the special knowledge the CLI has for arrays. This works as if it were an explicit implementation (but isn’t: it is done at runtime). Many tools will not show this implementation, this is described in the Remarks section of the Array class overview.

    You could add a cast:

    return ((IEnumerable<T>)_array).GetEnumerator();
    

    Note, older MSDN (pre learn.microsoft.com) coverage of this changed a few times with different .NET versions, check for the remarks section.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am implementing my own enumerable type. Something ressembling this: public class LineReaderEnumerable :
I'm implementing my own double-buffering for a BufferedImage in a JPanel so that I
I am implementing my own LinkedList . I've a class which calls MyLinkedLlist ,
Where can I get info about implementing my own methods that have the ellipsis
We have an application that is essentially implementing its own messaging queue. When a
So lately I've been thinking of building and implementing my own invoice system with
I am implementing my own ArrayList for school purposes, but to spice up things
Basically, I am implementing own cache system. Ideally, it'll look like this: $CACHE->start($name); //CODE
While implementing my own IFilter I found that most likely some consumers will require
I am implementing my own Java class for sorting a List<T> in eclipse. I

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.