你的位置: 码友网首页 / 资讯源列表 / Introducing C# 9: Extension GetEnumerator support for foreach loops

关于[Introducing C# 9: Extension GetEnumerator support for foreach loops]的摘要:

As you may know, in order to be able to iterate on a collection in C# with the foreach loop the collection must expose a public method GetEnumerator() which doesn’t exist on IEnumerator and IAsyncEnumerator interfaces. C# 9 allows to create an extension method to allow foreach loops on those interfaces. Let’s see in this article how to proceed.

原文地址: https://anthonygiretti.com/2020/11/01/introducing-c-9-extension-getenumerator-support-for-foreach-loops/

收录时间: 2020-11-03 浏览量: 1653 分类: C#开发

| 0 收藏 | 0