1.词汇
- variable 变量
2.例句
-
the technique of separating the two concerns like this makes it very easy to change the condition you’re testing for and the action you take on each of the matches independently.
像这样分离两个关注点的技术使我们可以轻松的改变测试条件并对每个匹配性采取单独的操作。
-
The delegate variables involved (test and print) could be passed into a method, and that same method could end up testing radically different conditions and taking radically different actions.
涉及到的委托变量(test和print)可以传递给一个方法,相同的方法可以用于测试完全不同的条件及执行完全不同的操作。
-
you could put all the testing and printing into one statement。
你也可以把testing和printing两个方法直接放到一行代码中。
3.代码
- 用一句话表达
List<Product> products = Product.GetSampleProducts();
products.FindAll(delegate(Product p) {
return p.Price > 10;})
.ForEach(Console.WriteLine);