Soenneker.Extensions.Long 11.0.249

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

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Extensions.Long

Unix-time conversion, checked Int32 conversion, and allocation-free decimal digit counts for long values.

Installation

dotnet add package Soenneker.Extensions.Long

Convert Unix seconds

using Soenneker.Extensions.Long;

long unixSeconds = 1_588_305_600;

DateTime utc = unixSeconds.ToDateTimeFromUnixTime();
DateTimeOffset instant = unixSeconds.ToDateTimeOffsetFromUnixTime();

Both methods interpret the value as seconds since 1970-01-01T00:00:00Z, not milliseconds. ToDateTimeFromUnixTime() returns a DateTime whose Kind is Utc; ToDateTimeOffsetFromUnixTime() returns an offset-zero value for the same instant.

The supported Unix-second range is -62,135,596,800 through 253,402,300,799. Values outside it throw ArgumentOutOfRangeException.

Narrow to an integer

int count = longCount.ToInt();

ToInt() performs a checked conversion. Values below Int32.MinValue or above Int32.MaxValue throw OverflowException; they are not truncated or wrapped.

Count decimal digits

int digits = (-12345L).DigitCount(); // 5
int zeroDigits = 0L.DigitCount();    // 1

DigitCount() counts digits in the absolute numeric value and does not count the minus sign. It handles the full long range, including long.MinValue, without converting to a string.

When the caller already guarantees a non-negative value, DigitCountPositiveOnly() exposes the shorter fast path:

int digits = positiveValue.DigitCountPositiveOnly();

DigitCountPositiveOnly() does not validate its precondition; negative inputs produce an incorrect result. Use DigitCount() unless non-negativity is established by the surrounding logic.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net11.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.Extensions.Long:

Package Downloads
Soenneker.Blazor.Utils.Ids

A lightweight ID generator for consistent identity across the UI for Blazor components.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.249 3,839 11/11/2026
11.0.248 1,648 11/10/2026
11.0.247 15,544 10/26/2026
4.0.246 9,888 10/14/2026
4.0.245 111 10/14/2026
4.0.240 1,999 10/12/2026
4.0.239 877 10/12/2026
4.0.238 3,980 10/11/2026
4.0.237 18,996 9/24/2026
4.0.235 6,952 9/15/2026
4.0.234 6,874 9/12/2026
4.0.233 22,190 8/30/2026
4.0.232 125 8/29/2026
4.0.231 28,062 7/27/2026
4.0.230 14,222 7/16/2026
4.0.229 18,170 6/18/2026
4.0.228 16,649 6/5/2026
4.0.227 25,481 4/22/2026
4.0.226 10,524 4/13/2026
4.0.225 134 4/13/2026
Loading failed

Upgrade .NET 11 release candidates to stable