foreach
foreach 双语例句
We iterate through it with foreach . 我们用foreach来遍历它。 We use a _ placeholder shortcut again in another function literal that we pass to foreach . 我们在传给foreach的这个字面函数中再一次使用了一个_占位符。 This time it is outside of the foreach loop , because we clearly only need one ! 这次它在foreach循环之外,因为我们只需要一个! The problem gets worse when you consider that the foreach method might want to call the lambda from other threads , so that the function could be applied to different elements of the collection in parallel . 在考虑到foreach方法可能希望调用来自其他线程中的lambda表达式这一情况时,问题变得更糟了起来,因为这样的话该函数就有可能会以并行的方式应用到集合中的不同元素上。