Bigoudi 0.0.1
dotnet add package Bigoudi --version 0.0.1
NuGet\Install-Package Bigoudi -Version 0.0.1
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="Bigoudi" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Bigoudi --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bigoudi, 0.0.1"
#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 Bigoudi as a Cake Addin #addin nuget:?package=Bigoudi&version=0.0.1 // Install Bigoudi as a Cake Tool #tool nuget:?package=Bigoudi&version=0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bigoudi
Un package pour faire des boucles.
Usage
Add using Bigoudi;
at the begining of the file. Then you can use the Loop
class and ForEach
extension method.
For loop
Loop.For(i => testOutputHelper.WriteLine($"i = {i}"), 6, 1, 2);
is equivalent of
for (int i = 1; i < 6; i += 2) { i => testOutputHelper.WriteLine($"i = {i}"); }
Outputs:
i = 1
i = 3
i = 5
start
and increment
parameters are optionals and defaults to respectively 0 and 1. So to make a simple "for loop" from 0 to 9 you can simply write:
Loop.For(i => { }, 10);
Iterate loop
Iterate is an alternative to For
where you can set the number of iterations wanted instead of a "length".
Loop.Iterate(i => testOutputHelper.WriteLine($"i = {i}"), 3, 1, 2);
Outputs:
i = 1
i = 3
i = 5
While loop
int i = 0;
Loop.While(() => testOutputHelper.WriteLine($"i = {i}"), () => i++ < 3);
Outputs:
i = 1
i = 2
i = 3
DoWhile loop
int i = 0;
Loop.DoWhile(() => testOutputHelper.WriteLine($"i = {i}"), () => i++ < 3);
Outputs:
i = 0
i = 1
i = 2
i = 3
ForEach loop
int[] ints = { 1, 2, 3 };
Loop.ForEach(ints, i =>
{
testOutputHelper.WriteLine($"i = {i}");
});
Outputs:
i = 1
i = 2
i = 3
ForEach loop with extension method
int[] ints = { 1, 2, 3 };
ints.ForEach(i =>
{
testOutputHelper.WriteLine($"i = {i}");
});
Outputs:
i = 1
i = 2
i = 3
...
Infinite loop
CancellationTokenSource cts = new CancellationTokenSource();
cts.CancelAfter(TimeSpan.FromSeconds(1));
try
{
var execute = () => { testOutputHelper.WriteLine("execute..."); Thread.Sleep(100); };
await Task.Run(() => Loop.Infinite(cts.Token, execute), cts.Token);
}
catch (OperationCanceledException)
{
testOutputHelper.WriteLine("loop ended");
}
Outputs:
execute...
execute...
execute...
execute...
execute...
execute...
execute...
execute...
execute...
execute...
loop ended
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- 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 |
---|---|---|
0.0.1 | 181 | 8/4/2023 |