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
                    
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="Spirantis.Extensions.System" Version="10.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Spirantis.Extensions.System" Version="10.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Spirantis.Extensions.System" />
                    
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 Spirantis.Extensions.System --version 10.0.0
                    
#r "nuget: Spirantis.Extensions.System, 10.0.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 Spirantis.Extensions.System@10.0.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=Spirantis.Extensions.System&version=10.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Spirantis.Extensions.System&version=10.0.0
                    
Install as a Cake Tool

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

MIT

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