jason-c-daniels - Jcd.DoWhenRun 1.0.2

A netstandard 1.0 set of extension methods, Do, DoWhen and Run, that give a Fluent builder-pattern-like experience to operating on IEnumerable and IEnumerable<T> derived types.

PM> Install-Package Jcd.DoWhenRun -Version 1.0.2 -Source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

Copy to clipboard

> nuget.exe install Jcd.DoWhenRun -Version 1.0.2 -Source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

Copy to clipboard

> dotnet add package Jcd.DoWhenRun --version 1.0.2 --source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

Copy to clipboard
<PackageReference Include="Jcd.DoWhenRun" Version="1.0.2" />
Copy to clipboard
source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

nuget Jcd.DoWhenRun  ~> 1.0.2
Copy to clipboard

> choco install Jcd.DoWhenRun --version 1.0.2 --source https://www.myget.org/F/jason-c-daniels/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "jason-c-daniels" -SourceLocation "https://www.myget.org/F/jason-c-daniels/api/v2"
Install-Module -Name "Jcd.DoWhenRun" -RequiredVersion "1.0.2" -Repository "jason-c-daniels" 
Copy to clipboard

Jcd.DoWhenRun

A netstandard 1.0 set of extension methods, Do, DoWhen and Run, that give a Fluent builder-pattern-like experience to operating on IEnumerable and IEnumerable<T> derived types.

Do

Do sets up an operation to perform on every item it iterates across.

DoWhen

DoWhen sets up an operation to perform on every item it iterates across that matches the predicate.

Run

Run enumerates an IEnumerable and therefore causes execution of the the code configured in Do and DoWhen blocks.

Example

    (from x in Enumerable.Range(0, 4)
     from y in Enumerable.Range(0, 4)
     select (x, y))
        .DoWhen((i,_)=>i > 0 && i % 4 == 0, (_,_)=>Console.WriteLine())
        .Do(t=>Console.Write(t))
        .Run();

    Console.WriteLine();
    
    /* outputs:
        (0, 0)(0, 1)(0, 2)(0, 3)
        (1, 0)(1, 1)(1, 2)(1, 3)
        (2, 0)(2, 1)(2, 2)(2, 3)
        (3, 0)(3, 1)(3, 2)(3, 3)            
    */            

GitHub Build status CodeFactor Grade

MyGet Nuget

API Docs

  • .NETStandard 1.0
    • NETStandard.Library (>= 1.6.1)
  • .NETStandard 1.0: 1.0.0.0

Owners

Jason C. Daniels

Authors

Jason C. Daniels

Project URL

https://github.com/jason-c-daniels/Jcd.DoWhenRun

License

MIT

Info

2 total downloads
1 downloads for version 1.0.2
Download (9.5 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
1.0.2 9.5 KB Sat, 16 Oct 2021 10:27:17 GMT 1
1.0.1 9.52 KB Sat, 16 Oct 2021 10:20:05 GMT 1