C#英语笔记Day 19

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);
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。