I have one list with 3 items
reg.ToList() Count = 3 System.Collections.Generic.List<string>
[0] "Text0" string
[1] "Text1" string
[2] "Text2" string
I want to change all item positions, first postion instead last one, and remaining items to stand up with one position
for this example
[0] "Text1" string
[1] "Text2" string
[2] "Text0" string
Use RemoveAt
method right after getting ahold of your first item, then add it back.
var item = list[0];
list.RemoveAt(0);
list.Add(item);
RemoveAt
will be more efficient than Remove
because it won't try to search through your list and compare values needlessly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With