更新时间:2023-02-08 17:31:01
LINQ
是quering记录。您当前的的foreach
循环更具可读性,如果你尝试其他的方法那么将在内部使用循环。
LINQ
is for quering records. Your current foreach
loop is more readable and if you try other approach then it will use loop internally.
您可以看到它修改使用LINQ收集这个答案,但它是不推荐的方式。
You can see this answer which modifies the collection using LINQ, but it is not the recommended way.