RangeForeach.Sources
0.1.0
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
<PackageReference Include="RangeForeach.Sources" Version="0.1.0" />
paket add RangeForeach.Sources --version 0.1.0
#r "nuget: RangeForeach.Sources, 0.1.0"
// 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...
}
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.1 | 40 | 2/13/2025 | |
1.3.0 | 35 | 2/12/2025 | |
1.2.8 | 244 | 2/8/2024 | |
1.2.5 | 248 | 1/12/2024 | |
1.2.0 | 241 | 12/6/2023 | |
1.1.0 | 293 | 4/4/2023 | |
1.0.1 | 266 | 3/12/2023 | |
1.0.0 | 269 | 3/12/2023 | |
0.9.0 | 310 | 3/8/2023 | |
0.8.5 | 259 | 3/7/2023 | |
0.8.1 | 334 | 3/5/2023 | |
0.8.0 | 310 | 3/5/2023 | |
0.7.0 | 365 | 1/19/2023 | |
0.6.0 | 311 | 12/31/2022 | |
0.5.0 | 454 | 9/27/2022 | |
0.4.0 | 477 | 7/20/2022 | |
0.2.0 | 481 | 7/19/2022 | |
0.1.1 | 554 | 7/5/2022 | |
0.1.0 | 447 | 7/3/2022 |