Pure.Primitives 3.7.0

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

Pure.Primitives

Concrete implementations of immutable, composable primitive types for the Pure ecosystem — type-safe wrappers over .NET primitive types with full AOT compatibility.

.NET build & test NuGet publish NuGet License: MIT

Overview

Pure.Primitives provides sealed record implementations of every interface defined in Pure.Primitives.Abstractions. Each type wraps a single .NET primitive value with lazy evaluation, is immutable by design, and exposes no mutation surface. All types implement GetHashCode and ToString as throw new NotSupportedException() — equality and formatting flow through the underlying value, not the wrapper.

Types

Bool

Type Implements Description
True IBool Singleton representing true
False IBool Singleton representing false

Char

Type Implements Description
Char IChar Single Unicode character

Number (INumber<T>)

Type Underlying type
Int int
Long long
Short short
UInt uint
ULong ulong
UShort ushort
Double double
Float float
Decimal decimal
Zero generic 0
MinInt / MaxInt int.MinValue / int.MaxValue
MinLong / MaxLong long.MinValue / long.MaxValue
MinShort / MaxShort short.MinValue / short.MaxValue
MinDouble / MaxDouble double.MinValue / double.MaxValue
MinFloat / MaxFloat float.MinValue / float.MaxValue
MinDecimal / MaxDecimal decimal.MinValue / decimal.MaxValue
MinUint / MaxUint uint.MinValue / uint.MaxValue
MinUlong / MaxUlong ulong.MinValue / ulong.MaxValue
MinUshort / MaxUshort ushort.MinValue / ushort.MaxValue

Date / Time

Type Implements Description
Date IDate Composed of INumber<ushort> day, month, year
Time ITime Hour, minute, second, millisecond, microsecond, nanosecond
DateTime IDateTime Composite of IDate and ITime
CurrentDate IDate Today's date
CurrentTime ITime Current time
CurrentDateTime IDateTime Current date and time
DateValidState IBool Whether a Date value is in range
TimeValidState IBool Whether a Time value is in range
HoursValidState IBool Whether hours are 0–23
MinutesValidState IBool Whether minutes are 0–59
SecondsValidState IBool Whether seconds are 0–59
MillisecondsValidState IBool Whether milliseconds are 0–999
MicrosecondsValidState IBool Whether microseconds are 0–999
NanosecondsValidState IBool Whether nanoseconds are 0–999

Day of Week

Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday — each implements IDayOfWeek with DayNumberValue 1–7.

Guid

Type Implements Description
Guid IGuid Wraps a System.Guid
EmptyGuid IGuid Guid.Empty
Ulid IGuid ULID generated via ByteAether.Ulid, stored as System.Guid

String

Type Implements Description
String IString Lazy string built from any IBool, IChar, INumber<T>, IDate, ITime, IDateTime, IDayOfWeek, IGuid, or raw string
EmptyString IString ""
NewLineString IString Environment.NewLine
WhitespaceString IString " "
ColonString IString ":"
CommaString IString ","
DotString IString "."
SemicolonString IString ";"
SingleQuoteString IString "'"
DoubleQuoteString IString "\""
LeftRoundBracketString IString "("
RightRoundBracketString IString ")"
LeftSquareBracketString IString "["
RightSquareBracketString IString "]"
LeftCurlyBracketString IString "{"
RightCurlyBracketString IString "}"

Design Principles

  • Immutable — no setters, no mutation; state is captured at construction time.
  • Lazy — internal values are wrapped in Lazy<T>; evaluation is deferred until first access.
  • Composable — types accept other Pure interfaces as constructor arguments, enabling composition without unwrapping.
  • AOT-compatible — IsAotCompatible = true; no reflection, no dynamic code generation.

Dependencies

  • Pure.Primitives.Abstractions — base interfaces (IBool, IChar, INumber<T>, IDate, ITime, IDateTime, IDayOfWeek, IGuid, IString) that every type in this package implements

Target Frameworks

  • .NET 7
  • .NET 8
  • .NET 9
  • .NET 10

Installation

dotnet add package Pure.Primitives

Usage

using Pure.Primitives.Number;
using Pure.Primitives.Date;
using Pure.Primitives.String;

// Compose primitives from other primitives — no raw .NET types needed at call sites
INumber<int> count = new Int(42);
IDate today = new CurrentDate();
IString label = new String(today); // "5/22/2026" — lazy, evaluated on first access

// Boundary constants
INumber<int> max = new MaxInt(); // int.MaxValue
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (22)

Showing the top 5 NuGet packages that depend on Pure.Primitives:

Package Downloads
Pure.Primitives.Random

Package Description

Pure.RelationalSchema

Package Description

Pure.Primitives.String.Operations

Package Description

Pure.Primitives.Choices

Package Description

Pure.Primitives.Switches

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.7.0 1,270 10/20/2026
3.6.5 8,420 6/17/2026
3.6.4 5,123 5/19/2026
3.6.3 1,444 5/6/2026
3.6.2 8,859 11/23/2025
3.6.1 1,304 11/18/2025
3.6.0 800 11/13/2025
3.5.0 1,205 11/8/2025
3.4.0 2,057 10/31/2025
3.3.0 3,276 9/8/2025
3.2.0 3,006 9/5/2025
3.1.1 942 9/1/2025
3.1.0 1,292 8/25/2025
3.0.0 2,432 6/11/2025
2.0.1 636 6/11/2025
2.0.0 1,583 6/3/2025
1.7.0 318 6/2/2025
1.6.1 261 5/29/2025
1.6.0 240 5/28/2025
1.5.0 910 5/28/2025
Loading failed