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.
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.
// Install RangeForeach.Sources as a Cake Addin
#addin nuget:?package=RangeForeach.Sources&version=0.1.0

// Install RangeForeach.Sources as a Cake Tool
#tool nuget:?package=RangeForeach.Sources&version=0.1.0

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.2.8 165 2/8/2024
1.2.5 193 1/12/2024
1.2.0 207 12/6/2023
1.1.0 255 4/4/2023
1.0.1 226 3/12/2023
1.0.0 232 3/12/2023
0.9.0 272 3/8/2023
0.8.5 223 3/7/2023
0.8.1 294 3/5/2023
0.8.0 271 3/5/2023
0.7.0 286 1/19/2023
0.6.0 279 12/31/2022
0.5.0 413 9/27/2022
0.4.0 435 7/20/2022
0.2.0 444 7/19/2022
0.1.1 516 7/5/2022
0.1.0 404 7/3/2022