A collection of utility classes for .NET including: domain model patterns (identity interfaces, deletable pattern), search and paging infrastructure, JSON reading/editing, process execution, and extension methods for strings and configuration.
$ dotnet add package Benday.CommonA 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.
IInt32Identity, IStringIdentity) and deletable pattern (IDeleteable)Search, SearchArgument, SearchResult, PageableResults)JsonEditor class (in Benday.Common.Json namespace)ProcessRunner, AsyncProcessRunner)SafeToString, SafeToInt32, IsNullOrEmpty, etc.)IConfigurationITypeRegistrationItem)dotnet add package Benday.Common
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);
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)) { /* ... */ }
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
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.