Repository navigation
OnixLabs.Core
Matthew Layton edited this page Nov 15, 2026
·
9 revisions
Foundational primitives, patterns, and extensions that address common gaps in the .NET Base Class Library. This package provides the low-level building blocks used throughout the ONIXLabs ecosystem, and is equally useful as a standalone utility library in any .NET application.
dotnet add package OnixLabs.Core- Strongly typed enumeration pattern (
Enumeration<T>). - Functional patterns (
Optional<T>,Result,Result<T>). - Preconditions and guard clause utilities.
- Specification pattern with LINQ-compatible expressions (
Specification<T>). - Value semantics interfaces (
IValueEquatable<T>,IValueComparable<T>). - Binary conversion abstractions (
IBinaryConvertible, span- and memory-based variants). - Collection generators with LINQ-style query support.
- Extension methods for arrays, objects, strings, comparables, random, and more.
- Extensions for
IEnumerable,IEnumerable<T>, andIQueryable<T>. - Reflection helpers for
Type. - Strongly typed
Base16,Base32,Base58, andBase64text types. - Extensions for
StringBuilderandEncoding.
The OnixLabs.Core package spans several namespaces. The reference is organised by namespace below.
Foundational patterns, primitives, abstractions, and general-purpose extensions.
| Type | Description |
|---|---|
| Enumeration<T> | Base class for the smart enumeration pattern. |
| Optional<T> | Functional optional/maybe base type. |
| Some<T> | The Optional<T> case representing a present value. |
| None<T> | The Optional<T> case representing an absent value. |
| OptionalEqualityComparer<T> | Equality comparer for Optional<T> values. |
| OptionalExtensions | Async extension methods over Task<Optional<T>>/ValueTask<Optional<T>>. |
| Result | Functional error-handling result (railway-oriented programming). |
| Success | The successful Result case. |
| Failure | The failed Result case, carrying an Exception. |
| Result<T> | Generic result carrying a value. |
| Success<T> | The successful Result<T> case. |
| Failure<T> | The failed Result<T> case. |
| ResultEqualityComparer<T> | Equality comparer for Result<T> values. |
| ResultExtensions | Extension methods over Result/Result<T>, including async combinators over Task/ValueTask receivers. |
| Specification<T> | Composable specification pattern over LINQ expression trees. |
| CriteriaSpecification<T> | Concrete criteria-based specification. |
| Preconditions | Guard-clause helpers (Check, Require, RequireNotNull). |
| PreconditionInterpolatedStringHandler | Interpolated string handler that formats precondition messages only when the precondition fails. |
| IValueEquatable<T> | Value-based equality contract. |
| IValueComparable<T> | Value-based comparison contract. |
| IBinaryConvertible | Conversion to a byte[]. |
| ISpanBinaryConvertible | Conversion to a ReadOnlySpan<byte>. |
| IMemoryBinaryConvertible | Conversion to a ReadOnlyMemory<byte>. |
| ArrayExtensions | Extensions for arrays. |
| ComparableExtensions | Extensions for IComparable<T>. |
| DateTimeExtensions | Extensions for DateTime. |
| ISpanParsableExtensions | Throwing parse helper for ISpanParsable<T>. |
| ObjectExtensions | Functional and conversion helpers for object. |
| RandomExtensions | Extensions for Random. |
| ReadOnlySequenceExtensions | Extensions for ReadOnlySequence<T>. |
| ReadOnlySpanExtensions | Content hash codes for ReadOnlySpan<byte> and ReadOnlySpan<char>. |
| StringExtensions | Extensions for string. |
| Type | Description |
|---|---|
| Collection | Factory generators for empty or pre-populated mutable and immutable collections. |
| IEqualityComparerExtensions | Resolves an optional IEqualityComparer<T> to a concrete comparer (in OnixLabs.Core.Collections.Generic). |
| Type | Description |
|---|---|
| ExpressionExtensions | Combines and negates boolean predicate expressions. |
| IEnumerableExtensions | LINQ-like helpers for IEnumerable and IEnumerable<T>. |
| IQueryableExtensions | Specification-based filtering for IQueryable<T>. |
| Type | Description |
|---|---|
| TypeExtensions |
Type extensions for rendering C# type-declaration strings. |
| TypeDeclarationFlags | Flags enum configuring type-declaration formatting. |
| Type | Description |
|---|---|
| Base16 | Strongly typed Base-16 (hexadecimal) value. |
| Base32 | Strongly typed Base-32 value. |
| Base58 | Strongly typed Base-58 value. |
| Base64 | Strongly typed Base-64 value. |
| IBaseCodec | Base-N codec contract (encode/decode). |
| IBaseValue | Non-generic Base-N value contract. |
| IBaseValue<T> | Generic Base-N value contract. |
| Base16Codec | Base-16 codec. |
| Base32Codec | Base-32 codec. |
| Base58Codec | Base-58 codec. |
| Base64Codec | Base-64 codec. |
| Base16FormatProvider | Base-16 format provider. |
| Base32FormatProvider | Base-32 format provider. |
| Base58FormatProvider | Base-58 format provider. |
| Base64FormatProvider | Base-64 format provider. |
| EncodingExtensions | Extensions for Encoding. |
| ReadOnlySpanExtensions | Base-N conversion extensions for ReadOnlySpan<byte>. |
| StringBuilderExtensions | Extensions for StringBuilder. |
| Item | Supported |
|---|---|
| Target frameworks | .NET 8.0, .NET 9.0, .NET 10.0, .NET 11.0 |
| Language version | C# 15 |
| License | Apache-2.0 |
ONIXLabs .NET Library · Repository · NuGet · License (Apache-2.0)
Copyright © ONIXLabs 2020. Licensed under the Apache License, Version 2.0.
- Enumeration<T>
- Optional<T>
- OptionalEqualityComparer<T>
- OptionalExtensions
- Result
- Result<T>
- ResultEqualityComparer<T>
- ResultExtensions
- Specification<T>
- Preconditions
- IValueEquatable<T>
- IValueComparable<T>
- IBinaryConvertible
- ISpanBinaryConvertible
- IMemoryBinaryConvertible
- ArrayExtensions
- ComparableExtensions
- DateTimeExtensions
- ISpanParsableExtensions
- ObjectExtensions
- RandomExtensions
- ReadOnlySequenceExtensions
- ReadOnlySpanExtensions
- StringExtensions
- Base16
- Base32
- Base58
- Base64
- IBaseCodec
- IBaseValue
- IBaseValue<T>
- Base16Codec
- Base32Codec
- Base58Codec
- Base64Codec
- Base16FormatProvider
- Base32FormatProvider
- Base58FormatProvider
- Base64FormatProvider
- EncodingExtensions
- ReadOnlySpanExtensions
- StringBuilderExtensions
- BigDecimal
- BigDecimalEqualityComparer
- BigDecimalOrdinalityComparer
- NumberInfo
- NumberInfoEqualityComparer
- NumberInfoOrdinalityComparer
- Int256
- Int512
- UInt256
- UInt512
- Float128
- Float256
- GenericMath
- NumericsExtensions
- ConversionMode
- ScaleMode
- Hash
- NamedHash
- Sha3
- Sha3Hash224
- Sha3Hash256
- Sha3Hash384
- Sha3Hash512
- Sha3Shake128
- Sha3Shake256
- MerkleTree
- MerkleTree<T>
- PrivateKey
- PublicKey
- NamedPrivateKey
- NamedPublicKey
- EcdhPrivateKey
- EcdhPublicKey
- EcdsaPrivateKey
- EcdsaPublicKey
- EddsaPrivateKey
- EddsaPublicKey
- RsaPrivateKey
- RsaPublicKey
- DigitalSignature
- DigitalSignatureAndPublicKey
- Salt
- Secret
- ICryptoPrimitive<T>
- IHashable
- IEcdhPrivateKey
- IEcdsaPrivateKey
- IEddsaPrivateKey
- IRsaPrivateKey
- IPrivateKeyDerivable<T>
- IPrivateKeyExportable
- IPrivateKeyImportable<T>
- IPrivateKeyPemImportable<T>
- IPrivateKeyPkcs8Exportable
- IPrivateKeyPkcs8Importable<T>
- IPrivateKeyPkcs8PemExportable
- IPrivateKeyRawExportable
- IPrivateKeyRawImportable<T>
- IPrivateKeyRawPemExportable
- IEcdhPublicKey
- IEcdsaPublicKey
- IEddsaPublicKey
- IRsaPublicKey
- IPublicKeyExportable
- IPublicKeyImportable<T>
- IPublicKeyPemExportable
- IPublicKeyPemImportable<T>
- IPublicKeyRawExportable
- IPublicKeyRawImportable<T>
- HashAlgorithmExtensions
- ReadOnlySpanExtensions