Take the 2-minute tour ×  i have List<sting> with 5 entries.
[0],[1],[2],[3],[4].  if I use List.Clear() all item are
removed.  i need remove till specific item, for example till
[1]. that means in my list are just 2 items [0] and [1]. how do
that with c#?  share|improve this question Are you talking about
the value "[1]" or the index 1? –  LukeH Jun 16 '11 at 14:04
Man, why is this question voted up? –  R0MANARMY Jun 16 '11 at
14:20  5 Answers 5  up vote 1 down vote accepted  You can use
the List.RemoveWhere(Predicate).. Alternatively, you can do a
for loop - looping backwards, removing items till the item
you're after ie  for(var i = List.Count()-1; i>=0; i--) {    var
item = List[i];    if (item != "itemThatYourLookingFor") {
share|improve this answer  If want to remove all items after
index 1 (that is, retain only the first two items):  if
(yourList.Count > 2)     yourList.RemoveRange(2, yourList.Count
- 2);  If you need to remove all items after the item with a
value of "[1]", regardless of its index:  i