I have the following list:
var list = new List<string>();
//
list.Add("foo");
list.Add("baa");
do something..
if(foo) {
//how to put baa in as first element in list?
}
I’m looking for alternative for this:
string item = "baa";
docTypes.Remove(item);
docTypes.Insert(0, item);
There is no alternative, that’s how you do it. If you want a bit of an efficiency improvement and you know the index, then you could use
RemoveAt: