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
Post a Comment