CSharpEssentials.Maybe
3.0.5
dotnet add package CSharpEssentials.Maybe --version 3.0.5
NuGet\Install-Package CSharpEssentials.Maybe -Version 3.0.5
<PackageReference Include="CSharpEssentials.Maybe" Version="3.0.5" />
<PackageVersion Include="CSharpEssentials.Maybe" Version="3.0.5" />
<PackageReference Include="CSharpEssentials.Maybe" />
paket add CSharpEssentials.Maybe --version 3.0.5
#r "nuget: CSharpEssentials.Maybe, 3.0.5"
#:package CSharpEssentials.Maybe@3.0.5
#addin nuget:?package=CSharpEssentials.Maybe&version=3.0.5
#tool nuget:?package=CSharpEssentials.Maybe&version=3.0.5
CSharpEssentials.Maybe
Maybe (Option) monad for null-safe, expressive code. Avoid NullReferenceException by making missing values explicit.
Features
- Maybe<T> — Explicit presence/absence of a value with implicit conversions.
- Functional API —
Map,Bind,Where,Match,Or,Tap. - LINQ Support — Query syntax with
Select,SelectMany,Where. - Async Support —
MapAsync,BindAsync, and awaitable extensions. - Result Bridge — Convert
Maybe<T>toResult<T>and back.
Installation
dotnet add package CSharpEssentials.Maybe
Usage
Creating Maybe
using CSharpEssentials.Maybe;
public Maybe<User> FindUser(int id)
{
User? user = _repo.Find(id);
return user; // implicit from T? to Maybe<T>
}
Maybe<string> none = Maybe<string>.None;
Maybe<int> value = Maybe<int>.From(42);
Functional Chaining
string city = FindUser(1)
.Where(u => u.IsActive)
.Map(u => u.Address)
.Map(a => a.City)
.GetValueOrDefault("Unknown");
LINQ Queries
Maybe<string> tracking =
from user in FindUser(1)
from order in FindOrder(user.Id)
where order.Amount > 100
select order.TrackingNumber;
Matching
FindUser(1).Match(
some: user => Console.WriteLine($"Found: {user.Name}"),
none: () => Console.WriteLine("Not found"));
Converting to Result
Maybe<Order> order = FindOrder(1);
Result<Order> result = order.ToResult(Error.NotFound("Order.Missing", "Order not found."));
// Result -> Maybe
Result<Order> result2 = Result.Success(new Order());
Maybe<Order> maybe = result2.AsMaybe();
Async
Maybe<Order> order = await FindUserAsync(1)
.BindAsync(user => GetOrderAsync(user.Id))
.MapAsync(order => EnrichAsync(order));
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. 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 is compatible. 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. net11.0 is compatible. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- CSharpEssentials.Errors (>= 3.0.5)
- CSharpEssentials.Results (>= 3.0.5)
- System.Text.Json (>= 9.0.4)
-
net10.0
- CSharpEssentials.Errors (>= 3.0.5)
- CSharpEssentials.Results (>= 3.0.5)
-
net11.0
- CSharpEssentials.Errors (>= 3.0.5)
- CSharpEssentials.Results (>= 3.0.5)
-
net9.0
- CSharpEssentials.Errors (>= 3.0.5)
- CSharpEssentials.Results (>= 3.0.5)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on CSharpEssentials.Maybe:
| Package | Downloads |
|---|---|
|
CSharpEssentials
A comprehensive C# library enhancing functional programming capabilities with type-safe monads (Maybe, Result), discriminated unions (Any), and robust error handling. Features include: domain-driven design support, enhanced Entity Framework integration, testable time management, JSON utilities, and LINQ extensions. Built for modern C# development with focus on maintainability, testability, and functional programming principles. |
|
|
CSharpEssentials.EntityFrameworkCore
Enhances Entity Framework Core with functional programming patterns and DDD-friendly features. Includes base entity classes, soft delete support, audit trails, query filters, optimistic concurrency, PostgreSQL integration, query performance monitoring, and domain event handling. Perfect for building maintainable and scalable data access layers in modern .NET applications. |
|
|
CSharpEssentials.Mediator
High-performance CQRS and pipeline behaviors built on the Mediator source-generator library. Provides Result-integrated commands, queries, validation, logging, caching, and transaction behaviors with full Native AOT support. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.5 | 36 | 5/7/2026 |
| 3.0.4 | 76 | 5/6/2026 |
| 3.0.3 | 84 | 5/5/2026 |
| 3.0.2 | 128 | 5/5/2026 |
| 3.0.1 | 136 | 5/3/2026 |
| 3.0.0 | 140 | 5/3/2026 |
| 2.1.0 | 294 | 11/26/2025 |
| 2.0.9 | 259 | 9/30/2025 |
| 2.0.8 | 232 | 9/29/2025 |
| 2.0.7 | 230 | 9/29/2025 |
| 2.0.6 | 243 | 9/29/2025 |
| 2.0.5 | 237 | 9/29/2025 |
| 2.0.4 | 246 | 9/28/2025 |
| 2.0.3 | 229 | 9/28/2025 |
| 2.0.2 | 230 | 9/28/2025 |
| 2.0.1 | 239 | 9/28/2025 |
| 2.0.0 | 243 | 9/28/2025 |