Sunlix.NET.DDD.ROP 1.0.2

Prefix Reserved
dotnet add package Sunlix.NET.DDD.ROP --version 1.0.2
                    
NuGet\Install-Package Sunlix.NET.DDD.ROP -Version 1.0.2
                    
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="Sunlix.NET.DDD.ROP" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sunlix.NET.DDD.ROP" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Sunlix.NET.DDD.ROP" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Sunlix.NET.DDD.ROP --version 1.0.2
                    
#r "nuget: Sunlix.NET.DDD.ROP, 1.0.2"
                    
#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.
#:package Sunlix.NET.DDD.ROP@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Sunlix.NET.DDD.ROP&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Sunlix.NET.DDD.ROP&version=1.0.2
                    
Install as a Cake Tool

Sunlix.NET.DDD.ROP

.NET NuGet License

Sunlix.NET.DDD.ROP is a lightweight implementation of the Railway-Oriented Programming pattern for C#.
It provides a composable Result<TSuccess, TFailure> type and a set of functional operators for building clear and predictable execution pipelines without exceptions.


Table of Contents


Why this library

  • Explicit error handling — no hidden control flow via exceptions
  • Composable pipelines — chain operations in a predictable way
  • Sync + async symmetry — every operator has async equivalent
  • Minimal abstraction — no frameworks, just primitives

Installation

dotnet add package Sunlix.NET.DDD.ROP

Usage

This section contains minimal examples demonstrating the API.
All examples are intentionally simplified and focus only on behavior.


Result

Result<User, Error> result = Result.Succeed<User, Error>(user);

if (result.IsSuccess)
{
    var value = result.Value;
}

Map / MapAsync

Transforms success value.

Result<User, Error> GetUser(int id) { ... }

UserDetails MapToDetails(User user) { ... }

Result<UserDetails, Error> result = GetUser(42)
    .Map(MapToDetails);

Async:

async Task<UserDetails> MapToDetailsAsync(User user) { ... }

Result<UserDetails, Error> result = await GetUser(42)
    .MapAsync(MapToDetailsAsync);

Bind / BindAsync

Chains operations that return Result.

Result<User, Error> GetUser(int id) { ... }

Result<Subscription, Error> GetSubscription(User user) { ... }

Result<Subscription, Error> result = GetUser(42)
    .Bind(GetSubscription);

Async:

async Task<Result<Subscription, Error>> GetSubscriptionAsync(User user) { ... }

Result<Subscription, Error> result = await GetUser(42)
    .BindAsync(GetSubscriptionAsync);

Tee / TeeAsync

Executes side effects on success.

void LogUser(User user) { ... }

Result<User, Error> result = GetUser(42)
    .Tee(LogUser);

Async:

async Task LogUserAsync(User user) { ... }

Result<User, Error> result = await GetUserAsync(42)
    .TeeAsync(LogUserAsync);

TeeError / TeeErrorAsync

Executes side effects on failure.

void LogError(Error error) { ... }

Result<User, Error> result = await GetUserAsync(42)
    .TeeError(LogError);

Async:

async Task LogErrorAsync(Error error) { ... }

Result<User, Error> result = await GetUserAsync(42)
    .TeeErrorAsync(LogErrorAsync);

FAQ

<details> <summary>Why not use exceptions?</summary>

Exceptions are for unexpected failures.
This library models expected outcomes explicitly via Result.

</details>

<details> <summary>When to use Map vs Bind?</summary>

  • Use Map when transforming a value
  • Use Bind when the function returns another Result

</details>

<details> <summary>Can I mix sync and async?</summary>

Yes. Every operation has async equivalents, and they compose naturally.

</details>

Product 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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.2 52 5/1/2026
1.0.1 48 5/1/2026

1.0.2 - 2026-01-05
Fixed
- Fixed XML documentation.