CSharpEssentials 3.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package CSharpEssentials --version 3.0.2
                    
NuGet\Install-Package CSharpEssentials -Version 3.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="CSharpEssentials" Version="3.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSharpEssentials" Version="3.0.2" />
                    
Directory.Packages.props
<PackageReference Include="CSharpEssentials" />
                    
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 CSharpEssentials --version 3.0.2
                    
#r "nuget: CSharpEssentials, 3.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 CSharpEssentials@3.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=CSharpEssentials&version=3.0.2
                    
Install as a Cake Addin
#tool nuget:?package=CSharpEssentials&version=3.0.2
                    
Install as a Cake Tool

CSharpEssentials

CSharpEssentials is the core meta-package that brings together the entire CSharpEssentials ecosystem. It provides a unified entry point to the library's most popular features and includes exclusive extension methods that bridge different modules (e.g., connecting Maybe with Result, or Json with Result).

🚀 Features

  • Unified Access: references key packages like Core, Errors, Result, Maybe, and Json.
  • Bridge Extensions: exclusive extensions that make different modules work together seamlessly.
    • Convert Maybe<T> to Result<T>.
    • Safe JSON property navigation returning Result<JsonElement>.
    • String manipulation returning Result<string>.

📦 Installation

dotnet add package CSharpEssentials

🛠 Usage

1. Maybe to Result Conversion

Seamlessly transition from optional values to success/failure results.

using CSharpEssentials.Maybe;
using CSharpEssentials.ResultPattern;

Maybe<User> maybeUser = GetUser();

// If Maybe has value -> Result.Success(value)
// If Maybe is None   -> Result.Failure(Error.NotFound(...))
Result<User> result = maybeUser.ToMaybeResult(Error.NotFound("User.Missing"));

2. Safe JSON Navigation

Avoid exceptions when traversing complex JSON structures.

using CSharpEssentials.Json;
using System.Text.Json;

JsonDocument doc = JsonDocument.Parse(jsonString);

// Returns Result<JsonElement?>
var element = doc.TryGetNestedProperty("users", "0", "address", "city");

if (element.IsSuccess)
{
    Console.WriteLine(element.Value?.GetString());
}

3. String Validations

Perform string operations that might fail (like trimming when empty) and get a Result back.

using CSharpEssentials.Core;

Result<string> clean = input.TrimStart("prefix_");
Product 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. 
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
3.0.3 0 5/5/2026
3.0.2 13 5/5/2026
3.0.1 78 5/3/2026
3.0.0 77 5/3/2026
2.1.0 277 11/26/2025
2.0.9 228 9/30/2025
2.0.8 207 9/29/2025
2.0.7 204 9/29/2025
2.0.6 224 9/29/2025
2.0.5 207 9/29/2025
2.0.4 222 9/28/2025
2.0.3 198 9/28/2025
2.0.2 218 9/28/2025
2.0.1 208 9/28/2025
2.0.0 218 9/28/2025
1.0.21 521 2/2/2025
1.0.20 393 1/29/2025
1.0.19 218 12/27/2024
1.0.18 278 12/18/2024
1.0.17 249 12/18/2024
Loading failed