I need to add string values to a string List and every added string value will have its own integer index. When all values added I need to sort string List by index and read all strings from the list. I am not sure what List to use which could accept two parameters(string index and string itself) and will have Sort option. Any suggestion?
My list example
6 MyString1
1 MyString2
9 MySTring3
2 MyString4
It sounds like you may just want
SortedList<int, string>orSortedDictionary<int, string>but it will depend on your exact requirements, which aren’t clear at the moment. Both of these classes are always sorted by key – you don’t explicitly sort. What do you need to do with the list?