RangeForeach.Sources 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RangeForeach.Sources --version 0.1.0
                    
NuGet\Install-Package RangeForeach.Sources -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RangeForeach.Sources" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RangeForeach.Sources" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="RangeForeach.Sources" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RangeForeach.Sources --version 0.1.0
                    
#r "nuget: RangeForeach.Sources, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=RangeForeach.Sources&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=RangeForeach.Sources&version=0.1.0
                    
Install as a Cake Tool

C# Range-Foreach Syntax Extensions

Provides the range-foreach syntax for C# 9.0 or higher.

Supported frameworks:

  • .NET Framework >= 4.0
  • .NET Core >= 1.0
  • .NET Standard >= 1.0

NOTE: Please add the PrivateAssets="all" attribute to the PackageReference to avoid dependency to this package:

<PackageReference Include="RangeForeach.Sources" Version="0.1.0" PrivateAssets="all" />

Range-Foreach Syntax

Reference this package to write foreach-loops like this:

foreach (var index in 0..100)
{
    // loop body...
}

which is equivalent to the legacy for-loop below:

for (int index = 0; index < 100; index++)
{
    // loop body...
}

NOTE: Use ^ to represent negative numbers, e.g. ^100..0 (instead of -100..0).

Stepped Syntax

If STEPPED_RANGE is defined, this syntax can also be used:

foreach (var index in (99..^1).Step(-2))
{
    // loop body...
}

Which is equivalent to the legacy for-loop below:

for (int index = 99; index >= 0; index -= 2)
{
    // loop body...
}
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.3 136 4/25/2025
1.3.2 173 4/9/2025
1.3.1 135 2/13/2025
1.3.0 111 2/12/2025
1.2.8 272 2/8/2024
1.2.5 271 1/12/2024
1.2.0 257 12/6/2023
1.1.0 321 4/4/2023
1.0.1 299 3/12/2023
1.0.0 307 3/12/2023
0.9.0 340 3/8/2023
0.8.5 292 3/7/2023
0.8.1 408 3/5/2023
0.8.0 375 3/5/2023 0.8.0 is deprecated because it has critical bugs.
0.7.0 399 1/19/2023
0.6.0 348 12/31/2022
0.5.0 493 9/27/2022
0.4.0 519 7/20/2022
0.2.0 523 7/19/2022
0.1.1 592 7/5/2022
0.1.0 488 7/3/2022