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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
NameObjectCollectionBaseis 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.