CSharpEssentials.Core 3.0.3

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

CSharpEssentials.Core

Foundational utilities and extensions for everyday .NET development. Zero internal dependencies.

Features

  • String Conversions — Pascal, Camel, Snake, Kebab, Macro, Train, Title, UnderscoreCamel.
  • Collection Helpers — Conditional add, null filtering, random selection, set comparison.
  • Functional Extensions — Null-safe execution (IfNotNull, IfNull, IfTrue, IfFalse).
  • Task HelpersWithCancellation, AsTask, AsValueTask.
  • GUID Utilities — URL-safe Base64 encoding, Version 7 GUID generation on .NET 9+.
  • Exception Helpers — Flatten inner exceptions and messages.
  • HTTP Constants — Common status codes as typed constants.

Installation

dotnet add package CSharpEssentials.Core

Usage

String Case Conversions

using CSharpEssentials.Core;

string text = "helloWorld";

text.ToPascalCase();          // "HelloWorld"
text.ToCamelCase();           // "helloWorld"
text.ToSnakeCase();           // "hello_world"
text.ToKebabCase();           // "hello-world"
text.ToMacroCase();           // "HELLO_WORLD"
text.ToTrainCase();           // "Hello-World"
text.ToTitleCase();           // "Hello World"
text.ToUnderscoreCamelCase(); // "_helloWorld"

Collection Extensions

var list = new List<string> { "a", "b" };

list.IfAdd(true, "c");
list.IfAddRange(true, ["d", "e"]);

list.ForEach(Console.WriteLine);

var filtered = list.WhereIf(true, x => x != "a");
var clean = new List<string?> { "a", null, "b" }.WithoutNulls();

var numbers = new[] { 1, 2, 3 };
numbers.GetRandomItem();
numbers.GetRandomItems(2);

Functional Extensions

object? data = GetData();

if (data.IsNull()) { /* ... */ }
if (data.IsNotNull()) { /* ... */ }

data.IfNotNull(d => Process(d));
data.IfNull(() => Initialize());

true.IfTrue(() => Console.WriteLine("yes"));
false.IfFalse(() => Console.WriteLine("no"));

Task Helpers

await SomeTask().WithCancellation(cts.Token);

string value = "hello";
Task<string> task = value.AsTask();
ValueTask<string> vt = value.AsValueTask();

GUID Utilities

Guid id = Guider.NewGuid();          // Version 7 on .NET 9+
string shortId = id.ToStringFromGuid(); // URL-safe Base64 (22 chars)
Guid parsed = shortId.ToGuidFromString();

Exception Helpers

try { /* ... */ }
catch (Exception ex)
{
    var innerExceptions = ex.GetInnerExceptions();
    var messages = ex.GetInnerExceptionsMessages();
}

HTTP Status Codes

int ok = HttpCodes.Ok;
int notFound = HttpCodes.NotFound;
int badRequest = HttpCodes.BadRequest;
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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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 (6)

Showing the top 5 NuGet packages that depend on CSharpEssentials.Core:

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.GcpSecretManager

A powerful .NET configuration provider for Google Cloud Secret Manager that enables seamless secret management in your applications. Features include region-specific secret handling, flexible filtering options, batch processing, automatic secret rotation, built-in retry policies, and JSON value flattening support. Perfect for cloud-native applications requiring secure and scalable secret management.

CSharpEssentials.Errors

Comprehensive error handling system for functional programming in C#. Provides Error types, ErrorMetadata, ErrorType enums, and extensions for robust error management. Foundation for Result pattern and functional error handling.

CSharpEssentials.Any

Discriminated union types (Any<T0,T1> to Any<T0,...,T7>) for functional programming in C#. Provides type-safe alternatives to object/dynamic with pattern matching, implicit conversions, and JSON serialization support. Essential for functional programming patterns and type-safe handling of multiple possible types.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.4 4 5/6/2026
3.0.3 89 5/5/2026
3.0.2 182 5/5/2026
3.0.1 262 5/3/2026
3.0.0 264 5/3/2026
2.1.0 369 11/26/2025
2.0.9 329 9/30/2025
2.0.8 322 9/29/2025
2.0.7 308 9/29/2025
2.0.6 304 9/29/2025
2.0.5 311 9/29/2025
2.0.4 317 9/28/2025
2.0.3 312 9/28/2025
2.0.2 316 9/28/2025
2.0.1 303 9/28/2025
2.0.0 323 9/28/2025