I have a problem which I cant seem to find answer to through searches (either that or I am searching for the completely wrong thing!). I have a list of items called "Top 10" in a sortedlist item that is populated from my DB (SortedList<int, string> where int is position and string is item). I want to be able to move items up & down the list order at the click of a button and then save the new order back to the DB. I am OK with the DB part it is just the re-ordering I am really struggling with. Is a SortedList the correct collection for this?
Many thanks for any advice offered.
A
SortedListis for maintaining order within your SortedList as you add or remove items from it.You should create a custom list of your objects and then sort on property of that object.
So if your entry in your database was like this you could place it in an object, add it to a list and then sort it using Lambda on which ever criteria you like
You can also then use
RemoveAt()andInsert()to move items about to custom positions within the list.