CSharp.Pipe 1.0.0

Enabeling Piping in c#

There is a newer version of this package available.
See the version list below for details.
Install-Package CSharp.Pipe -Version 1.0.0
dotnet add package CSharp.Pipe --version 1.0.0
<PackageReference Include="CSharp.Pipe" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CSharp.Pipe --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

CSharp.Pipe

This lib is made to bring piping to c#.
It dos not add any functionality but it makes the code more readable. Its just syntactic sugar!

lets say you have these functions :

    private int _val = 6;

    private int GetById(int id) => _val;
    private static Func<int, int> Add(int x) => y => x + y;

    private Action<int> Save(int id ) => val => _val = val;

normally if would lock like

    const int id = 2;
    var v = GetById(id);
    v = Add(v)(2);
    Save(id)(v);

but with the piping it looks like

    const int id = 2;
    GetById(id)
        .Pipe(Add(2))
        .Pipe(Save(id));

More examples in the tests

CSharp.Pipe

This lib is made to bring piping to c#.
It dos not add any functionality but it makes the code more readable. Its just syntactic sugar!

lets say you have these functions :

    private int _val = 6;

    private int GetById(int id) => _val;
    private static Func<int, int> Add(int x) => y => x + y;

    private Action<int> Save(int id ) => val => _val = val;

normally if would lock like

    const int id = 2;
    var v = GetById(id);
    v = Add(v)(2);
    Save(id)(v);

but with the piping it looks like

    const int id = 2;
    GetById(id)
        .Pipe(Add(2))
        .Pipe(Save(id));

More examples in the tests

Release Notes

enabeling piping for Func and Action

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.1 387 5/16/2018
1.0.0 369 3/8/2018