Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does implementing IEnumerable<T> FORCE you to also implement the (non-generic) IEnumerable interface?
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/221691/why-does-ienumerablet-inherit-from-ienumerable">Why does IEnumerable&lt;T&gt; inherit from IEnumerable?</a> </p> </blockquote> <p>Folks,</p> <p>I started playing at implementing IEnumerable... actually it was an SOF "noob homework question" which got me started on this line. Yes, I <em>AM</em> that bored. </p> <p>So I sit down to pop-out a quick SSCCE for an IEnumerable. Ask if you want to see my code, but it's not really pertinent to my question. Anyway, soon the cogs started turning (slowly, as my cogs are known to do) and... For the life of me, I can't imagine <em>WHY</em> implementing the <code>IEnumerable&lt;T&gt;</code> interface also forces you to expose the (non-generic) IEnumerable interface.</p> <p>I've just been Googling for about half-an-hour, but haven't found anything which enlightens me as to why exposing the non-generic enumerator was made mandatory... when I actively <strong>DON'T WANT TO DO THAT</strong>, because I don't want non-generics code inveigling it's way into my codebase, and if it does I want it to fail. </p> <p>The MS engineers are, IMHO, some of the best on the planet, so I know there MUST be a damn-good-reason (and quite possibly more than one) for this design decision.</p> <p>So please can someone put me out of my misery and elighten me, please?</p> <h1>What I've found so far</h1> <ul> <li><a href="http://www.google.com/search?q=implement+IEnumerable%3CT%3E&amp;hl=en&amp;sourceid=gd&amp;rlz=1Q1GGLD_enAU352AU352&amp;aq=t" rel="nofollow noreferrer">Google: implement IEnumerable</a></li> <li><p><a href="https://stackoverflow.com/questions/53967/how-would-you-implement-the-ienumerator-interface">SOF: How would you implement the IEnumerator interface?</a></p> <ul> <li>Which leads to <strong>Jay Bazuzi's answer:</strong> (partialy quoted below)</li> </ul></li> </ul> <blockquote> <p>Raymond Chen's recent series of blog posts ("The implementation of iterators in C# and its consequences") is a good place to get up to speed. </p> <ul> <li>Part 1: [<a href="http://blogs.msdn.com/oldnewthing/archive/2008/08/12/8849519.aspx][1]" rel="nofollow noreferrer">http://blogs.msdn.com/oldnewthing/archive/2008/08/12/8849519.aspx][1]</a></li> <li>Part 2: [<a href="http://blogs.msdn.com/oldnewthing/archive/2008/08/13/8854601.aspx][2]" rel="nofollow noreferrer">http://blogs.msdn.com/oldnewthing/archive/2008/08/13/8854601.aspx][2]</a></li> <li>Part 3: [<a href="http://blogs.msdn.com/oldnewthing/archive/2008/08/14/8862242.aspx][3]" rel="nofollow noreferrer">http://blogs.msdn.com/oldnewthing/archive/2008/08/14/8862242.aspx][3]</a></li> <li>Part 4: [<a href="http://blogs.msdn.com/oldnewthing/archive/2008/08/15/8868267.aspx][4]" rel="nofollow noreferrer">http://blogs.msdn.com/oldnewthing/archive/2008/08/15/8868267.aspx][4]</a></li> </ul> </blockquote> <p>So I had quick squiz through "Part 1" and soon found my brain yielding null, and my finite state machine trying to backup my wazoo. I also quickly realised that I'm getting further and further off track.</p> <h1>What question should I be asking?</h1> <p>Yes, What's my question? Surely this MUST have been asked and answered (many times) before... but I can't find diddly. I guess I don't even know enough to ask the right question . Sooo... A google search term would do nicely.</p> <p>Thank you all in advance for your time. I do appreciate it.</p> <p>Cheers. Keith.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload