ModernBCL.Core.BLC 1.2.1

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

πŸ“˜ ModernBCL.Core.BLC

Modern 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:

  • Enterprise systems that must stay on .NET Framework 4.8 / 4.8.1
  • Developers wanting modern BCL APIs and patterns on legacy frameworks
  • Teams needing high-quality hashing, guard clauses, or modern date APIs
  • Projects migrating from .NET Framework β†’ .NET, but needing behavioral parity

🎯 Project Goals

βœ” High-performance hashing

  • Drop-in System.HashCode polyfill (Framework-only)
  • HashAccumulator (32-bit) and HashAccumulator64 (64-bit)
  • Order-sensitive, deterministic hashing
  • Zero allocations

βœ” Modern guard clauses

  • Fluent Guard.Against() API
  • Polyfilled [CallerArgumentExpression]
  • Cleaner constructors and APIs

βœ” Modern date & time APIs

  • System.DateOnly
  • System.TimeOnly

βœ” Index / Range polyfills

  • System.Index
  • System.Range
  • Compiler-compatible (supports lowering rules)

βœ” Modern slicing helpers

Unified slicing helpers layered on top of Index / Range:

using ModernBCL.Core.Slicing;

var slice = data.Slice(
    Index.FromStart(1),
    Index.FromEnd(1)
);

Equivalent to data[1..^1] in C# 8+.

Supports:

  • T[]
  • IList<T>
  • string (via char[])
  • DateOnly[], DateTime[]

πŸš€ Installation

dotnet add package ModernBCL.Core.BLC --version 1.2.1

πŸ“¦ Compatibility

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

samples/
 β”œβ”€ GuardsSample
 β”œβ”€ HashingSample
 └─ SystemSample

All samples:

  • Target .NET Framework 4.8
  • Use C# 7.3–compatible syntax
  • Demonstrate real runtime behavior

🧾 Changelog

Version 1.2.1 (Latest)

  • Index / Range polyfills finalized
  • Unified slicing helpers (ModernBCL.Core.Slicing)
  • System samples completed
  • Stability fixes and API polish

Version 1.2.0

  • Multi-targeting
  • HashAccumulator64
  • Guard API
  • Benchmarks

πŸ“„ License

MIT License.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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 was computed.  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 Framework net48 is compatible.  net481 is compatible. 
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
1.2.1 90 1/2/2026
1.2.0 95 11/29/2025
1.1.1 172 11/25/2025
1.1.0 176 11/25/2025