Get get part of list after certain value

I have got a simple question I am having a list:

List<string> test = new List<string> {"one", "two", "three", "four"}

Now I want to take for example value "three" and get all elements after it, so it would be looking like:

List<string> test = new List<string> {"three", "four"}

But we do not know where list end so it can be list of many elements and we can not define end as const.

Is it possible?

Jon Skeet
people
quotationmark

It sounds like you're looking for SkipWhile from LINQ:

test = test.SkipWhile(x => x != "three").ToList();

That will skip everything until (but not including) the "three" value, then include everything else. It then converts it to a list again.

people

See more on this question at Stackoverflow