c# - Does List<T> guarantee insertion order? -


I have 3 strings in a list (for example "1", "2", "3").

Then I want to reorder them to place 1 space in place of "2", such as "2", "1", "3".

I am using this code (indexToMoveTo to 1):

  ListInstance. Remove (itemtv); List Instant. (Institatomovato, Madtomov);  

It seems to work, but I sometimes get weird results; Sometimes the order is wrong or the items are being removed from the list!

Any thoughts? list & lt; T & gt; Guarantee orders?

related:

< P> Class Guarantee Order - The list will be maintained in the list that you add, which contains duplicates, unless you explicitly sort the list.

You can get strange results from your code if you are transferring the item later in the list, because your phone will move all other items in one place before calling.

Do you boil down your code to do something to post?


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -