[Mono-list] System.Collections.ArrayList Patch

Thong (Tum) Nguyen tum@veridicus.com
Sun, 4 May 2003 13:23:19 +1200


Hi Ben,

It's a shame that Microsoft copies the array.  In reality you should
never adapt any IList into an ArrayList.  It makes no sense (much like a
lot of the Collections namespace).  IList should define a method called
Sort() or there should be a generic Sort() method (somewhere) that works
for all Lists.

Mono's Adapter.Sort() can be "better" tho :-).

^Tum

> -----Original Message-----
> From: mono-list-admin@lists.ximian.com [mailto:mono-list-
> admin@lists.ximian.com] On Behalf Of Ben Maurer
> Sent: Sunday, 4 May 2003 2:01 a.m.
> To: Thong (Tum) Nguyen
> Cc: 'Piers Haken'; 'Mono List'; Nick Drochak
> Subject: RE: [Mono-list] System.Collections.ArrayList Patch
> 
> On Sat, 2003-05-03 at 01:00, Thong (Tum) Nguyen wrote:
> > That won't work because the wrapper doesn't use dataArray.  The
wrapped
> > list might not even be a wrapper.
> That's why I have to copy it to a new array.
> > My implementation supported almost all the missing functions and had
a
> > few bug fixes as well.  It also implemented sort *directly* on the
inner
> > list rather than making a temporary copy of an array (so it would be
> > much faster).
> I profiled an application running on the Microsoft bcl. It turns out
> that when you call Sort () on a wrapper, it does the exact same
behavior
> I do. So it looks like Microsoft is fine with the speed of copying the
> array.
> 
> I talked to Nick however and he agreed that it would be better to do
the
> sort directly on the wrapper. Feel free to submit a patch that does
> that. I will check it in if it passes NUnit tests.
> 
> --Ben Maurer
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list