how to replace values in list in C#? -


i have list:

list<string> strlist=new list<string>(); strlist.add("uk"); strlist.add("us"); strlist.add("india"); strlist.add("australia"); 

i want change index of elements in list:

the current index of "us" 1, want replace 3 , "australia" should 1.

if know indices already, can use 'swap' them:

var temp = strlist[1]; strlist[1] = strlist[3]; strlist[3] = temp; 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -