Option and Result types for C# to simplify functional programming.
$ dotnet add package DanomDanom provides Option and Result types for C#, inspired by F#. It’s designed to be easy to use, efficient, and compatible with existing C# codebases. These types offer a type-safe way to represent nullable values and expected errors, while also supporting a fluent API (e.g., map, bind) for chaining operations and value transformations.
netstandard2.1 compatible.Install the Danom NuGet package:
dotnet add package Danom
OR
PM> Install-Package Danom
One of the places the Result type really shines is input validation. It's a natural step in most workflows to validate input data before processing it, and the Result type is a great way to handle this. The Danom.Validation library provides an API for defining validation rules and checking input data against those rules, returning a Result<T, ResultErrors> that contains either the validated data or an error message.
Since Danom introduces types that are most commonly found in your model and business logic layers, external integrations are not only inevitable but required to provide a seamless experience when building applications.
These are completely optional, but provide a great way to integrate Danom with your codebase.
Danom is integrated with ASP.NET Core MVC (and Razor Pages) via Danom.Mvc. This library provides a set of utilities to help integrate the core types with common tasks in ASP.NET Core MVC applications.
Danom is integrated with ASP.NET Core Minimal API via Danom.MinimalApi. This library provides a set of utilities to help integrate the core types with common tasks in ASP.NET Core Minimal API applications.
There's an issue for that.
Licensed under MIT.