Steve,
CollectionBase implements IEnumerable.
Doh! I knew that I typed the wrong one :-(
In my subclass I have created my own new GetEnumerator() method (oddly
enough, MS decided not to make that method virtual).
Why have you created a new one???
CollectionBase encapsulates an ArrayList, CollectionBase.GetEnumerator
returns this ArrayList's Enumerator.
Classes that derive from CollectionBase operate on this ArrayList via the
protected List or InnerList properties. CollectionBase.List causes the
protected virtual CollectionBase.On* methods to be called, while
CollectionBase.InnerList allows direct access to the ArrayList itself,
without calling the CollectionBase.On* methods.
Not being virtual seems to be the correct design decision for the class!
So I have to ask:
Why are you creating your own GetEnumerator method?
Can you post code on what you are really doing?
I can, however, get it to work properly in a DataGrid if I explicitly
implement IList in my subclass -- even though CollectionBase already
implements it. When I do this, the DataGrid properly fills all my items.
(Although I still never see my GetEnumerator() method called--but at least
the DataGrid now works.)
Correct! CollectionBase implements IList and directs every thing to its
encapsulated ArrayList. However you may have created a new GetEnumerator in
your class, CollectionBase, hence its IList implementation will not know
about it.
So again:
Why are you creating your own GetEnumerator method?
Can you post code on what you are really doing?
Hope this helps
Jay