Spirantis.Extensions.System
10.0.0
dotnet add package Spirantis.Extensions.System --version 10.0.0
NuGet\Install-Package Spirantis.Extensions.System -Version 10.0.0
<PackageReference Include="Spirantis.Extensions.System" Version="10.0.0" />
<PackageVersion Include="Spirantis.Extensions.System" Version="10.0.0" />
<PackageReference Include="Spirantis.Extensions.System" />
paket add Spirantis.Extensions.System --version 10.0.0
#r "nuget: Spirantis.Extensions.System, 10.0.0"
#:package Spirantis.Extensions.System@10.0.0
#addin nuget:?package=Spirantis.Extensions.System&version=10.0.0
#tool nuget:?package=Spirantis.Extensions.System&version=10.0.0
Spirantis.Extensions.System
Lightweight, dependency-free extension methods for common System types — date/time conversions, span-aware string trimming, and reflection-based type discovery.
All extensions live in the System namespace, so they're available without an extra using once the package is referenced.
Installation
dotnet add package Spirantis.Extensions.System
Requirements
- .NET 10.0 or later
Features
DateTime extensions
DateTime now = DateTime.UtcNow;
// Milliseconds since the Unix epoch (floored)
double ms = now.ToMillisecondTimestamp();
// Minutes elapsed since midnight (0–1439)
int minutes = now.ToMinutesSinceMidnight();
// Seconds elapsed since midnight (0–86399)
int seconds = now.ToSecondsSinceMidnight();
string / ReadOnlySpan<char> extensions
Trim a whole substring (not just individual characters) from either end, with a configurable StringComparison:
"file.txt.txt".TrimEnd(".txt", StringComparison.Ordinal);
// => "file"
" prefix-prefix-value".AsSpan()
.TrimStart("prefix-", StringComparison.Ordinal);
// => "value" (span overload, allocation-free)
Overloads are provided for both string (returns string) and ReadOnlySpan<char> (returns ReadOnlySpan<char>, no allocation).
IEnumerable<Type> extensions
Find every type that derives from a given base type or open generic, at any depth:
Type[] allTypes = typeof(MyClass).Assembly.GetTypes();
// Non-generic base type (transitive — all descendants)
IEnumerable<Type> shapes = allTypes.Derives(typeof(Shape));
// Open generic base type (e.g. all types deriving from Repository<T>)
IEnumerable<Type> repos = allTypes.Derives(typeof(Repository<>));
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.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 |
|---|---|---|
| 10.0.0 | 116 | 6/8/2026 |