SUMMARY

Sequence support has been in .NET since the beginning. Its implementation in the framework is object oriented, based on interfaces. While it has always been possible to implement custom sequences, or iterators, by implementing those interfaces, the iterator support introduced in C# 2.0 made this task much easier. In spite of the heavy use Microsoft itself has made of this feature, the concept of iterators has remained vague for many developers. This chapter has demonstrated the basics of the syntax, and the rest of the book has many more iterator implementations to offer.

Get Functional Programming in C#: Classic Programming Techniques for Modern Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.