C#英语笔记Day 122

1.词汇

  • Features related to the type system 和类型系统有关的特性

2.例句

  • Extension methods are also there for the sake of LINQ but can be useful outside it.

    扩展方法也是为了LINQ而存在的,但在LINQ之外也可以用。

  • Think of all the times you’ve wished that a framework type had a certain method, and you’ve had to write a static utility method to implement it.

    想想你一直希望一个框架类型有一个特定的方法,而你必须编写一个静态实用程序方法来实现它。

  • For instance, to create a new string by reversing an existing one, you might write a static StringUtil.Reverse method.

    例如,要通过反转现有字符串来创建新字符串,x需要编写一个静态StringUtil.Reverse方法。

  • Well, the extension method feature effectively lets you call that static method as if it existed on the string type itself, so you could write

    现在,扩展方法特性可以有效地让您调用静态方法,就好像它本身就是字符串类型的方法一样,所以您可以这样写

string x = "dlrow olleH".Reverse();
  • Extension methods also let you appear to add methods with implementations to interfaces, and LINQ relies on this heavily, allowing calls to all kinds of methods on IEnumerable<T> that have never previously existed.

    扩展方法还允许您将带有实现的方法添加到接口中,而LINQ非常依赖这个特性,允许对以前从未存在的IEnumerable<T>上的所有类型的方法进行调用。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容