Why does the Add method on the NameObjectCollectionBase insert at index position 0? Is there a way to insert the new item at the end of the collection?
I'm facing this problem in .Net 2.0
I'm not allowed to change the collection.
Why does the Add method on the NameObjectCollectionBase insert at index position 0? Is there a way to insert the new item at the end of the collection?
I'm facing this problem in .Net 2.0
I'm not allowed to change the collection.
NameObjectCollectionBase
is based on a Hashtable/Dictionary, hence it is 'unsorted' by nature.
I think you are looking for a SortedList
.
Update: If you cannot change the class, you are out of luck. Just remember after each add/insert the 'positions' may change.