High-performance polyfills for modern .NET BCL features in legacy .NET Framework 4.8/4.8.1. Includes HashCode polyfill, HashAccumulator, Guard API, CallerArgumentExpression, and more.
$ dotnet add package ModernBCL.Core.BLCModern Polyfills for Legacy .NET Framework 4.8 / 4.8.1
ModernBCL.Core.BLC brings high-performance, zero-allocation replacements for missing modern BCL APIs to legacy .NET Framework apps — enabling performance, safety, and clarity normally available only in .NET 7/8.
This library is especially useful for:
System.HashCode polyfill (Framework-only)HashAccumulator (32-bit) and HashAccumulator64 (64-bit)Guard.Against() API[CallerArgumentExpression]System.DateOnlySystem.TimeOnlySystem.IndexSystem.RangeUnified slicing helpers layered on top of Index / Range:
using ModernBCL.Core.Slicing;
var slice = data.Slice(
Index.FromStart(1),
Index.FromEnd(1)
);
Equivalent to in C# 8+.
data[1..^1]Supports:
T[]IList<T>string (via char[])DateOnly[], DateTime[]dotnet add package ModernBCL.Core.BLC --version 1.2.1| Target | Behavior |
|---|---|
| .NET Framework 4.8 / 4.8.1 | Polyfills enabled |
| .NET 8+ | Native BCL used |
Multi-targeted NuGet package:
net48; net481; net8.0
samples/
├─ GuardsSample
├─ HashingSample
└─ SystemSample
All samples:
ModernBCL.Core.Slicing)MIT License.