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




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.
| Type | Implements | Description |
|---|
True | IBool | Singleton representing true |
False | IBool | Singleton representing false |
| Type | Implements | Description |
|---|
Char | IChar | Single Unicode character |
| 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 |
| 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 |
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday — each implements IDayOfWeek with DayNumberValue 1–7.
| Type | Implements | Description |
|---|
Guid | IGuid | Wraps a System.Guid |
EmptyGuid | IGuid | Guid.Empty |
Ulid | IGuid | ULID generated via ByteAether.Ulid, stored as System.Guid |
| 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 | "}" |
- 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.
Pure.Primitives.Abstractions — base interfaces (IBool, IChar, INumber<T>, IDate, ITime, IDateTime, IDayOfWeek, IGuid, IString) that every type in this package implements
- .NET 7
- .NET 8
- .NET 9
- .NET 10
dotnet add package Pure.Primitives
usingPure.Primitives.Number;usingPure.Primitives.Date;usingPure.Primitives.String;// Compose primitives from other primitives — no raw .NET types needed at call sitesINumber<int>count=newInt(42);IDatetoday=newCurrentDate();IStringlabel=newString(today);// "5/22/2026" — lazy, evaluated on first access// Boundary constantsINumber<int>max=newMaxInt();// int.MaxValue