CollectionBase and sorting

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Hello!

I'm reading a book and here I have found something that sounds strange.
It says the following:
"Note that some classes in the System.Collection namespace, including
CollectionBase, don't
expose a method for sorting. If you want to sort a collection you have
derived from this class you''ll
have to put a bit more work in and sort the internal List collection
youself."

So assume I have derived a class from this CollectionBase I can use either
the List or InnerList to sort by objects
that is implementing either CompareTo or Compare.

My question is what exactly do they mean in the text above with "you''ll
have to put a bit more work in and sort the internal List collection
youself."

//Tony
 
Indeed it looks like you should be able to just use InnerList.Sort() -
although note that I would recommend using the generic classes like
List<T> and Collection<T> in place of the 1.1 CollectionBase...

Marc
 
Back
Top