Introducing C# 9: Extension GetEnumerator support for foreach loops

added by DotNetKicks
11/2/2020 4:39:17 PM

472 Views

As you may know, in order to be able to iterate on a collection in 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.


0 comments