[Mono-list] ArrayList.GetEnumerator
Gaurav Vaish
gvaish@iitk.ac.in
Sun, 4 Nov 2001 13:09:24 +0530
Hello,
I was thinking one thing - if the GetEnumerator() returns plain
ArrayListEnumeratorSimple then there may be a problem. And I was wondering
as to how you got to this conclusion since the documentation reads:
Returns an enumerator for the entire ArrayList.
[C#] public virtual IEnumerator GetEnumerator();
Returns an enumerator for a section of the ArrayList.
[C#] public virtual IEnumerator GetEnumerator(int, int);
and hence there may be no need of the ...Simple class to be defined
anywhere. You can simple return an instance of a class that implements
IEnumerator - though I find a very few in the documentation
(ms-help://MS.NETFrameworkSDK/cpref/html/frlrfSystemCollectionsIEnumeratorCl
assTopic.htm). May be an internal class prove to be of more value than a
private class since the class will then be available to other classes in the
assembly and if required can be used in relevant places.
What do you say Nick?
Cheers,
Gaurav Vaish
----------------------------
----- Original Message -----
From: "Nick Drochak" <ndrochak@gol.com>
To: <mono-list@ximian.com>
Cc: "'Alexander Klyubin'" <klyubin@aqris.com>
Sent: Sunday, November 04, 2001 04:07
Subject: RE: [Mono-list] ArrayList.GetEnumerator
> Alexander,
>
> I agree.
>
> The name of the concrete class is right there in the VS.Net debugger's
> local window, so I can't help but see the name :)
>
> As you and others have suggested, I'll just make a "simple" class that
> implements the interface and that'll be it for now. It'll be better than
> just returning null :)
>
> Thanks,
> Nick D.
>
> > -----Original Message-----
> > From: Alexander Klyubin [mailto:klyubin@aqris.com]
> > Sent: Sunday, November 04, 2001 4:49 AM
> > To: Nick Drochak
> > Subject: Re: [Mono-list] ArrayList.GetEnumerator
> >
> >
> > As I see it, you should not worry about the concrete class that
> > implements IEnumerable interface. As far as contract for
> > .GetEnumerator
> > is concerned it is allowed to return any class implementing
> > IEnumerable.
> > I think you should stop looking and names of concrete
> > classes, this if
> > not the right way to go. Just implement the contract for the method
> > properly. Also, looking at methods provided by the class returned by
> > Microsoft implementation might be a violation of intellectual
> > property
> > rights...
> >
> > Regards,
> > Alexander Klyubin
> >
> > Nick Drochak wrote:
> >
> > > Hi all,
> > >
> > > I found that one of my ReadOnlyCollection tests is failing
> > because we
> > > haven't implemented ArrayList.GetEnumerator() yet.
> > >
> > > I thought I'd just whip that one out real quick so my test
> > would pass,
> > > but low and behold I find out MS's
> > ArrayList.GetEnumerator() returns
> > > an object of type "ArrayListEnumeratorSimple." I can't find a
> > > reference to this class anywhere.
> > >
> > > Perhaps it's just an internal (embedded?) class in the MS ArrayList
> > > class and any ol' class that implements IEnumerator will do? Any
> > > ideas or opinions on this one? I hate it when my test fails.
> > >
> > > Thanks,
> > > Nick D.
> > >
> > >
> > >
> > > _______________________________________________
> > > Mono-list maillist - Mono-list@ximian.com
> > > http://lists.ximian.com/mailman/listinfo/mono-list
> > >
> >
> >
> >
> >
> >
>
>
>
> _______________________________________________
> Mono-list maillist - Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list