Skip to content

Latest commit

 

History

History
114 lines (83 loc) · 2.35 KB

File metadata and controls

114 lines (83 loc) · 2.35 KB

📘 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.