search List for string .StartsWith()

后端 未结 10 1757
终归单人心
终归单人心 2021-01-19 00:13

I have a

List

with 1500 strings. I am now using the following code to pull out only string that start with the string prefix

10条回答
  •  既然无缘
    2021-01-19 00:19

    You can use PLINQ (Parallel LINQ) to make the execution faster:

    var newList = list.AsParallel().Where(x => x.StartsWith(prefixText)).ToList()
    

提交回复
热议问题