UtilBlast 2.0.0

dotnet add package UtilBlast --version 2.0.0
                    
NuGet\Install-Package UtilBlast -Version 2.0.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="UtilBlast" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UtilBlast" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="UtilBlast" />
                    
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 UtilBlast --version 2.0.0
                    
#r "nuget: UtilBlast, 2.0.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 UtilBlast@2.0.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=UtilBlast&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=UtilBlast&version=2.0.0
                    
Install as a Cake Tool

UtilBlast ⚡

NuGet License

UtilBlast is a lightweight utility + abstractions library for .NET.
It bundles extensions, interfaces, and a Factory for quick bootstrapping with dependency injection (DI) — designed to work in apps, LINQPad, and PowerShell.


✨ Features

  • Extensions

    • DateTime helpers (start/end of day, working days, unix time, etc.)
    • String helpers (PascalCase, CamelCase, SnakeCase, etc.)
    • Math helpers (Add, Multiply, Clamp, Factorial, etc.)
    • DataTable formatting (Dump(), RFC 4180 ToCsv() / ParseCsvToDataTable(), filtering, sorting, distinct rows)
    • IEnumerable<T>.ToCsv() — reflect properties, write CSV in one line (new in 1.1)
    • JsonCsv bridge (JsonToCsv(), CsvToJson()) — auto-flattens nested objects + arrays (new in 1.1)
    • JObject.Flatten() and JToken.GetByPath("a.b[0].c") for nested-JSON ergonomics (new in 1.1)
    • Json (pretty-print, serialize/deserialize with Newtonsoft)
    • Markdown (parse YAML metadata frontmatter)
    • Guidbyte[] conversions
    • ExpandoObject.Dump() for debugging
  • Interfaces

    • IFileHelper – file and directory utilities (read, write, zip, cleanup)
    • ILocalStorage – in-memory key/value store with TTL, regex queries, persistence
    • ISqlGenerator – simple SQL (SELECT/INSERT/UPDATE/DELETE) + parameter mapping
    • IBlastLogger – logging abstraction (default adapter wraps ILogger<T>)

    Note: UtilBlast 2.0 no longer ships IDynamicClassBuilder / IDynamicClassGenerator. For runtime class generation use the AssemblyBlast sibling package directly.

  • Factory 🔥

    • UtilBlastFactory.Create() → get a ready-to-use DI container
    • UtilBlastFactory.Get<T>() → one-liner to resolve a service
    • Built-in console logging option, or plug in your own IBlastLogger

🚀 Install

dotnet add package UtilBlast

🖥 Usage

In a .NET app

using Microsoft.Extensions.DependencyInjection;
using UtilBlast;
using UtilBlast.Interfaces;

var services = new ServiceCollection()
    .AddLogging(b => b.AddConsole())
    .AddUtilBlast();

var provider = services.BuildServiceProvider();
var files = provider.GetRequiredService<IFileHelper>();

files.WriteFile("test.txt", "Hello, UtilBlast!");

In LINQPad

// Press F4 -> Add NuGet -> UtilBlast + Microsoft.Extensions.Logging.Console

var log = UtilBlast.UtilBlastFactory.Get<UtilBlast.Interfaces.IBlastLogger>();
log.Information("Hello from UtilBlast in LINQPad!");

var store = UtilBlast.UtilBlastFactory.Get<UtilBlast.Interfaces.ILocalStorage>();
store.SetData("user", "Alice");
store.ListAllData().Dump();

In PowerShell 7+

# Load assemblies (from NuGet install folder)
Add-Type -Path ".\lib\UtilBlast.dll"
Add-Type -Path ".\lib\Microsoft.Extensions.Logging.Console.dll"

# Create provider
$provider = [UtilBlast.UtilBlastFactory]::Create($true)

# Resolve and use services
$file = $provider.GetRequiredService([UtilBlast.Interfaces.IFileHelper])
$file.WriteFile("ps-demo.txt", "Hello from PowerShell")

⚙️ Dependency Injection

Register everything into your own IServiceCollection:

services.AddUtilBlast(opt =>
{
    opt.DefaultLifetime = ServiceLifetime.Singleton;
    // opt.LoggerFactory = sp => new MySerilogLogger(...);
});

📦 Why UtilBlast?

  • One NuGet, many helpers
  • Works in apps, scripts, and LINQPad with zero boilerplate
  • Abstractions for clean testing (IFileHelper, ILocalStorage, …)
  • Extensions to cut boilerplate in day-to-day code
  • Plug-and-play DI setup with Factory

🤖 AI assistants

This assembly carries the Blast.PrimaryFacade convention: an [AssemblyMetadata("Blast.PrimaryFacade", "...")] attribute names the canonical front-door type(s) of the package, so AI helpers (e.g. TaskBlaster's script assistant) can identify the entry points without scanning every public type.

For UtilBlast the front doors are:

Type Purpose
UtilBlast.Tabular.Blast The Blast display DSL: WriteHeading / WriteStatus / WriteKv / WriteTable.
UtilBlast.UtilBlastFactory Bootstrapping helpers for DI / one-line use from scripts.

Read it back from a loaded assembly via reflection:

var facade = typeof(UtilBlast.UtilBlastFactory).Assembly
    .GetCustomAttributes<AssemblyMetadataAttribute>()
    .FirstOrDefault(a => a.Key == "Blast.PrimaryFacade")?.Value;

The value is a hint for tooling; consumers don't need to read it.


📄 License

MIT © 2025 — Free to use and modify.

Product Compatible and additional computed target framework versions.
.NET 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. 
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
2.0.0 125 4/28/2026
1.3.0 104 4/28/2026
1.2.1 131 4/27/2026
1.2.0 171 4/26/2026
1.1.0 98 4/26/2026
1.0.2 171 4/23/2026
1.0.0 95 4/23/2026