PipeEx.StructuredConcurrency
0.1.0-alpha.1
dotnet add package PipeEx.StructuredConcurrency --version 0.1.0-alpha.1
NuGet\Install-Package PipeEx.StructuredConcurrency -Version 0.1.0-alpha.1
<PackageReference Include="PipeEx.StructuredConcurrency" Version="0.1.0-alpha.1" />
<PackageVersion Include="PipeEx.StructuredConcurrency" Version="0.1.0-alpha.1" />
<PackageReference Include="PipeEx.StructuredConcurrency" />
paket add PipeEx.StructuredConcurrency --version 0.1.0-alpha.1
#r "nuget: PipeEx.StructuredConcurrency, 0.1.0-alpha.1"
#addin nuget:?package=PipeEx.StructuredConcurrency&version=0.1.0-alpha.1&prerelease
#tool nuget:?package=PipeEx.StructuredConcurrency&version=0.1.0-alpha.1&prerelease
PipeEx
PipeEx is a lightweight C# library that enables fluent, pipe-like function chaining. By leveraging the I
(Infer) extension method, you can pass the result of one function directly into the next, resulting in cleaner and more maintainable code.
Table of Contents
Features
- Fluent Syntax: Create readable chains of function calls.
- Asynchronous Support: Seamlessly chains both synchronous and asynchronous operations (
Task<T>
). - Simplified Code: Reduces nesting and complexity, making your code easier to maintain.
- Lightweight: No dependencies without compromising on expressiveness.
Installation
Install PipeEx via NuGet:
dotnet add package PipeEx
For Structured Concurrency support, install:
dotnet add package PipeEx.StructuredConcurrency
Usage
Synchronous Operations
The core feature of PipeEx is the I
extension method. It lets you pipe the output of one function as the input to the next:
public int Calc(int x) => x.I(FuncY)
.I(x => x + 2);
You can also automatically destructure tuples:
public int Calc(int x) => x.I(x => (x + 2, x + 4))
.I((x, y) => x + y);
Asynchronous Operations
PipeEx supports chaining asynchronous operations. The library automatically handles awaiting tasks:
// awaiting is handled automatically
public Task<int> Calc(int x) => x.I(FuncXAsync)
.I(x => x + 2)
.I(FuncYAsync)
.I(FuncY);
Planned Features
- Structured Concurrency: Declare asynchronous variables that are resolved at a later point.
- Cancellation: Support for initializing and propagating cancellation tokens (e.g., StructuredTask<T>).
- Resource Management: Enhanced handling for resources that are not thread-safe (like EF Core DbContext or WPF UI updates).
Contributing
Contributions are welcome! If you would like to submit improvements, please fork the repository and open a pull request. For major changes, please open an issue first to discuss what you would like to change.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net9.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.