C# in Depth

Cover of C# in Depth
Order now (3rd edition)

Features of Enumerable.Range

Chapter 10: Extension methods: 10.3.1

Created: 3/4/2008
Last updated: 3/4/2008

One feature of Enumerable.Range which isn't supported by the Range class in chapter 6 is the ability to create an empty range. Because both ends of the range are inclusive, you always end up with at least one entry.

This made the code in chapter 6 simpler, but it's nice to be able to specify an empty range. The "real" range class in MiscUtil includes this feature, of course.