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" />
<PackageVersion Include="RangeForeach.Sources" Version="0.1.0" />
<PackageReference Include="RangeForeach.Sources" />
paket add RangeForeach.Sources --version 0.1.0
#r "nuget: RangeForeach.Sources, 0.1.0"
#addin nuget:?package=RangeForeach.Sources&version=0.1.0
#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.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.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 |