diff --git a/README.md b/README.md index bbad927..1715ffa 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # RangeExtensions [![CI/CD](https://github.com/neon-sunset/RangeExtensions/actions/workflows/dotnet-releaser.yml/badge.svg)](https://github.com/neon-sunset/RangeExtensions/actions/workflows/dotnet-releaser.yml) [![nuget](https://badgen.net/nuget/v/RangeExtensions/latest)](https://www.nuget.org/packages/RangeExtensions/) [![Coverage Status](https://coveralls.io/repos/github/neon-sunset/RangeExtensions/badge.svg)](https://coveralls.io/github/neon-sunset/RangeExtensions) -Extensions for Range type to support `foreach` and `RangeEnumerable` that implements `IEnumerable`. -- Correctness is verified against standard `IEnumerable` and `Enumerable.Range` behavior -- Performance is hand tuned to produce efficient native code with no allocations as long as `RangeEnumerable` isn't boxed into `IEnumerable` (same applies to enumerator) +This package allows you to use `0..100` in `foreach` expressions and implements `RangeEnumerable` that supports a variety of LINQ-like operations as well as `ICollection` and `IEnumerable`. +- Correctness is verified against standard `IEnumerable` and `Enumerable.Range` behavior; +- Performance is hand tuned to produce efficient native code with no allocations as long as `RangeEnumerable` isn't boxed (same applies to enumerator). However, even when boxed it is still faster than `Enumerable.Range`. ## Features ### Range enumeration ```cs -foreach (var i in 0..100) +foreach (var i in ..100) // you can write 0..Length as just ..Length { Console.WriteLine(i); } diff --git a/RangeExtensions/RangeEnumerable.cs b/RangeExtensions/RangeEnumerable.cs index 74fc20a..ba6e2c8 100644 --- a/RangeExtensions/RangeEnumerable.cs +++ b/RangeExtensions/RangeEnumerable.cs @@ -41,6 +41,7 @@ public record struct Enumerator : IEnumerator { private readonly int _shift; private readonly int _end; + private int _current; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/RangeExtensions/RangeExtensions.csproj b/RangeExtensions/RangeExtensions.csproj index 46d3d4e..0932c95 100644 --- a/RangeExtensions/RangeExtensions.csproj +++ b/RangeExtensions/RangeExtensions.csproj @@ -1,4 +1,4 @@ - + neon-sunset @@ -6,7 +6,7 @@ MIT Range;Extensions;LINQ;IEnumerable;foreach;RangeForEach README.md - Extensions for Range type to support 'foreach' and 'RangeEnumerable' that implements 'IEnumerable'. + Extensions for Range that add foreach and ICollection/IEnumerable support.