[Mono-list] ArrayList Enumerator

Nick Drochak ndrochak@gol.com
Sun, 4 Nov 2001 16:10:31 +0900


Hi all,

I added the skeleton of an enumerator class to ArrayList.  The guts
still need to be implemented, actually most of ArrayList's guts need to
be implemented, so this shouldn't come as a surprise.

BTW, the class status page shows that this class is 100% done.  Not
true.  I think the interface is done, but almost every method still
needs to be implemented.  I'll work on this now if no one else is
currently on it.

Anyway, here is the diff of what I changed:

Index: ArrayList.cs
===================================================================
RCS file: /cvs/public/mcs/class/corlib/System.Collections/ArrayList.cs,v
retrieving revision 1.4
diff -u -r1.4 ArrayList.cs
--- ArrayList.cs        2001/09/25 12:58:06     1.4
+++ ArrayList.cs        2001/11/04 03:00:57
@@ -287,12 +287,22 @@
                                            int arrayIndex, int count) {
                }

+               private class ArrayListEnumerator : IEnumerator {
+                       // TODO: Constructor should take a snapshot
+                       public ArrayListEnumerator(int index, int
count){}
+
+                       // TODO: Implement these methods...
+                       public object Current {get{return null;}}
+                       public bool MoveNext(){return true;}
+                       public void Reset(){}
+               }
+
                public virtual IEnumerator GetEnumerator () {
-                       return null;
+                       return new ArrayListEnumerator(0, this.Count);
                }

                public virtual IEnumerator GetEnumerator (int index, int
count)
{
-                       return null;
+                       return new ArrayListEnumerator(index, count);
                }

                public virtual ArrayList GetRange (int index, int count)
{