Benday.Common 9.12.0

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

Benday.Common

A collection of utility classes for .NET including: domain model patterns, search and paging infrastructure, JSON reading/editing, process execution, and extension methods for strings and configuration.

Key Features

  • Domain Model Support - Identity interfaces (IInt32Identity, IStringIdentity) and deletable pattern (IDeleteable)
  • Search & Paging - Classes for handling searching, sorting, and paging of results (Search, SearchArgument, SearchResult, PageableResults)
  • JSON Editing - Path-based JSON reading and editing with JsonEditor class (in Benday.Common.Json namespace)
  • Process Execution - Utility classes for running command line tools, reading results, and managing errors (ProcessRunner, AsyncProcessRunner)
  • String Extensions - Safe string operations, null handling, and type conversions (SafeToString, SafeToInt32, IsNullOrEmpty, etc.)
  • Configuration Extensions - Extension methods for accessing values from IConfiguration
  • Dependency Injection - Interfaces for organizing type registration (ITypeRegistrationItem)

Installation

dotnet add package Benday.Common

Target Frameworks

  • .NET 8.0
  • .NET 9.0
  • .NET 10.0
  • .NET Standard 2.1

Quick Examples

JSON Editing

using Benday.Common.Json;

// Load and edit JSON
var editor = new JsonEditor(jsonString, true);

// Read values at any depth
var value = editor.GetValue("ConnectionStrings", "DefaultConnection");

// Set values (creates intermediate nodes if needed)
editor.SetValue("newValue", "Settings", "Feature", "Enabled");

// Get typed values
bool? isEnabled = editor.GetValueAsBoolean("Settings", "IsEnabled");
int? timeout = editor.GetValueAsInt32("Settings", "Timeout");

// Output modified JSON
string result = editor.ToJson(indented: true);

String Extensions

using Benday.Common;

string? maybeNull = GetSomeValue();

// Safe operations that handle nulls
string safe = maybeNull.SafeToString("default");
int number = maybeNull.SafeToInt32(-1);
bool contains = maybeNull.SafeContains("search");

// Null checks as extension methods
if (maybeNull.IsNullOrEmpty()) { /* ... */ }
if (maybeNull.IsNullOrWhitespace()) { /* ... */ }

// Case-insensitive comparison
if (value1.EqualsCaseInsensitive(value2)) { /* ... */ }

About

Written by Benjamin Day Pluralsight Author | Microsoft MVP | Scrum.org Professional Scrum Trainer https://www.benday.com https://www.slidespeaker.ai info@benday.com YouTube: https://www.youtube.com/@_benday

Bugs? Suggestions? Contribute?

Got ideas for features you'd like to see? Found a bug? Let us know by submitting an issue. Want to contribute? Submit a pull request.

Source code

API Documentation

NuGet Package

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 is compatible.  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. 
.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 (4)

Showing the top 4 NuGet packages that depend on Benday.Common:

Package Downloads
Benday.EfCore.SqlServer

A collection of classes for supporting the repository pattern and domain model pattern in .NET Core with Entity Framework Core.

Benday.CosmosDb

A collection of classes for implementing the domain model and repository patterns with Azure Cosmos DB. Features hierarchical partition key support, LINQ queries with automatic partition keys, optimistic concurrency with ETags, ASP.NET Core dependency injection helpers, and per-repository custom container configuration.

Benday.Common.Testing

A collection of classes to streamline testing with XUnit and Moq, featuring a comprehensive assertion framework with fluent syntax and descriptive error messages.

Benday.Repositories

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.1-alpha 93 4/3/2026
10.0.0-alpha 75 4/3/2026
9.12.0 409 3/5/2026
9.11.0 93 3/5/2026
9.10.0 677 12/17/2025
9.9.0 296 12/17/2025
9.8.0 299 12/17/2025
9.7.0 528 12/16/2025
9.6.0 245 11/25/2025
9.5.0 313 11/12/2025
9.4.0 701 7/20/2025
9.3.0 266 5/30/2025
9.2.0 165 5/30/2025
9.1.0 303 4/24/2025
9.0.0 169 4/19/2025
9.0.0-alpha 194 2/16/2024
8.0.0 815 1/7/2024
7.1.0 283 10/2/2023
7.0.0 568 3/31/2023
7.0.0-beta 324 3/16/2023
Loading failed

v9.12 - Added GetDictionary() extension methods for JsonNode and JsonArray to convert JSON arrays of name/value pairs into Dictionary<string, string>;
v9.11 - Added JsonNode/JsonArray extension methods (GetString, GetInt32, GetArray, GetArrayItem, SafeGetArrayItem, FirstOrDefaultWithPropertyName) for simplified JSON manipulation; Made JsonEditor.GetNode() public to enable combined usage with extension methods;
v9.10 - Added JsonExtensionMethods to help with reading JsonElement values safely without throwing exceptions;
v9.9 - Added JsonEditor and SiblingValueArguments classes in new Benday.Common.Json namespace (merged from Benday.JsonUtilities package);
v9.8 - Added get non-empty strings method to StringExtensionMethods;
v9.7 - Added support for netstandard2.1;
v9.6 - Modifying process runner to expose the process and optionally kill it; Adding AsyncProcessRunner for running processes asynchronously;
v9.5 - Updating dependencies to .net 10.0;
v9.4 - Added IsNullOrEmpty() to string extension methods; Added compiler hint attributes to indicate when the input strings for IsNullOrEmpty() and IsNullOrWhitespace() are not null;
v9.3 - Added ConfigurationExtensionMethods; Added ToStringThrowIfNullOrEmpty() and SafeToString() to the ConfigurationExtensionMethods class for accessing values from IConfiguration.
v9.2 - Added ToStringThrowIfNullOrEmpty() to the StringExtensionMethods class.
v9.1 - Added some additional methods to the StringExtensionMethods class.
v9.0 - Updating dependencies and adding package target for .net 9.0