List<string> strings = new List<string>() { "foo", "bar", "baz" };
strings.Insert(0, "qux");
The list will end up with this in it:
- qux
- foo
- bar
- baz
Addendum 10/12/2018: The zero doesn't have to be a zero. You may use this trick to insert midstream into a list.
No comments:
Post a Comment