PosInformatique.Foundations.Bcl 1.7.0

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

PosInformatique.Foundations.Bcl

NuGet version NuGet downloads

Introduction

Extensions for common .NET types. This package supports .NET 8, .NET 9, .NET 10 and .NET 11, trimming and Native AOT. The extensions are in the System namespace.

Install

dotnet add package PosInformatique.Foundations.Bcl

Date / Time

GetUtcToday() returns the current UTC date from a TimeProvider. GetLocalToday() returns the date in the provider's LocalTimeZone, which is not necessarily the user's time zone. The two dates can differ around midnight.

using System;

var utcToday = TimeProvider.System.GetUtcToday();
var localToday = TimeProvider.System.GetLocalToday();

Reflection

IsGeneric(genericType) checks whether a type has the specified generic type definition. It does not search base types or implemented interfaces. The argument must be a generic type definition; otherwise, an ArgumentException is thrown.

using System;
using System.Collections.Generic;

var isList = typeof(List<int>).IsGeneric(typeof(List<>)); // true
var isDictionary = typeof(List<int>).IsGeneric(typeof(Dictionary<,>)); // false

String

Truncate(maxLength) returns the original string if it fits, or a prefix of at most the specified number of UTF-16 code units. A negative length throws ArgumentOutOfRangeException. Truncation may split a surrogate pair.

using System;

var text = "Hello world".Truncate(5); // "Hello"

Uri

AppendPath(paths) appends path components to an absolute URI while preserving its query and fragment. Null and empty components are ignored, and leading and trailing slashes between components are normalized to one slash. A relative URI throws InvalidOperationException.

using System;

var uri = new Uri("https://example.com/api?key=1")
    .AppendPath("users", "42"); // https://example.com/api/users/42?key=1

All methods throw ArgumentNullException for null arguments, except individual AppendPath() path components, which may be null and are ignored.

Changelog

See CHANGELOG.md for release history.

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 is compatible.  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 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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net11.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

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.7.0 51 11/23/2026
1.7.0-rc.1 51 11/23/2026

1.7.0
 - Initial release with extensions for strings, URIs, time providers, and generic type inspection.