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
<PackageReference Include="PosInformatique.Foundations.Bcl" Version="1.7.0" />
<PackageVersion Include="PosInformatique.Foundations.Bcl" Version="1.7.0" />
<PackageReference Include="PosInformatique.Foundations.Bcl" />
paket add PosInformatique.Foundations.Bcl --version 1.7.0
#r "nuget: PosInformatique.Foundations.Bcl, 1.7.0"
#:package PosInformatique.Foundations.Bcl@1.7.0
#addin nuget:?package=PosInformatique.Foundations.Bcl&version=1.7.0
#tool nuget:?package=PosInformatique.Foundations.Bcl&version=1.7.0
PosInformatique.Foundations.Bcl
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.
Links
| Product | Versions 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. |
-
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.