Oxtensions 1.1.0

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

Oxtensions

High-performance, production-ready .NET extension methods library.

License: MIT Target Frameworks


πŸ“¦ Installation

dotnet add package Oxtensions

πŸ—‚οΈ Extension Categories

Namespace Class Description
Oxtensions.String StringExtensions Slug, masking, casing, validation, safe parsing β†’
Oxtensions.Byte ByteExtensions Hex, Base64, MD5/SHA-256 hashing β†’
Oxtensions.Date DateTimeExtensions Β· DateOnlyExtensions Β· DateTimeOffsetExtensions Unix timestamps, boundaries, workday navigation, ISO 8601 β†’
Oxtensions.Collections ListExtensions Β· DictionaryExtensions Β· StackExtensions Β· QueueExtensions Chunking, pagination, merge, query string, stack/queue bulk ops β†’
Oxtensions.Enum EnumExtensions Description/Display attribute, flags, safe parse β†’
Oxtensions.DataTable DataTableExtensions Typed mapping with reflection cache, JSON export β†’
Oxtensions.Generic GenericExtensions Null guards, deep clone, JSON, IN predicate β†’
Oxtensions.Numeric IntExtensions Β· LongExtensions Β· DoubleExtensions Β· DecimalExtensions Sign, parity, clamp, prime, factorial, digits, rounding, currency β†’
Oxtensions.Char CharExtensions Vowel/consonant, ASCII category, case and whitespace predicates β†’
Oxtensions.Identifiers GuidExtensions IsEmpty, ToShortString, NewComb (time-ordered GUID) β†’
Oxtensions.Durations TimeSpanExtensions Β· IntDurationExtensions Β· LongDurationExtensions IsPositive/Negative/Zero, Abs, TotalWeeks, fluent builders β†’
Oxtensions.Streams StreamExtensions Β· ByteStreamExtensions ToByteArray, Base64, ReadAllText, GZip compress/decompress β†’
Oxtensions.Async TaskExtensions FireAndForget, WithTimeout, WithCancellation, Retry β†’

⚑ Quick Examples

using Oxtensions.Async;
using Oxtensions.Byte;
using Oxtensions.Char;
using Oxtensions.Collections;
using Oxtensions.DataTable;
using Oxtensions.Date;
using Oxtensions.Durations;
using Oxtensions.Enum;
using Oxtensions.Generic;
using Oxtensions.Identifiers;
using Oxtensions.Numeric;
using Oxtensions.Streams;
using Oxtensions.String;

// String
"Hello WΓΆrld! NaΓ―ve".ToSlug();          // "hello-world-naive"
"1234567890123456".Mask(4, 4);          // "1234********3456"
"hello world".ToPascalCase();           // "HelloWorld"
"user@example.com".IsValidEmail();      // true

// Byte
byte[] data = Encoding.UTF8.GetBytes("hello");
data.ToHexString();                      // "68656C6C6F"
data.ComputeSHA256().ToHexString();      // SHA-256 hex

// DateTime
new DateTime(2026, 2, 20).NextWorkday();         // 2026-02-23
946684800L.FromUnixTimestamp();                  // 2000-01-01 00:00:00 UTC

// DateOnly
new DateOnly(2026, 2, 20).NextWorkday();         // 2026-02-23 (Friday β†’ Monday)
new DateOnly(2026, 6, 15).StartOfYear();         // 2026-01-01
new DateOnly(2026, 6, 15).ToDateTime();          // 2026-06-15 00:00:00

// DateTimeOffset
DateTimeOffset.UtcNow.ToUnixTimestamp();         // Unix seconds
946684800L.ToDateTimeOffset();                   // 2000-01-01T00:00:00+00:00
new DateTimeOffset(2026, 2, 22, 15, 0, 0, TimeSpan.FromHours(3)).ToIso8601String();
// "2026-02-22T15:00:00+03:00"

// Collections β€” List
new[] {1,2,3,4,5}.Chunk(2);             // [[1,2],[3,4],[5]]
items.Paginate(0, 10);                   // first 10 items

// Collections β€” Dictionary
dict.GetOrDefault("key", "fallback");
dict.Merge(otherDict, overwrite: true);
new Dictionary<string,string>{{"q","hello"}}.ToQueryString(); // "q=hello"

// Enum
MyEnum.Active.GetDescription();          // [Description] attribute value
MyEnum.Active.GetDisplayName();          // [Display(Name=)] attribute value

// DataTable
var users = dataTable.ToList<User>();    // reflection-cached mapping
var json  = dataTable.ToJson();

// Generic
person.ThrowIfNull(nameof(person));
5.In(1, 3, 5, 7);                        // true
original.Clone();                        // deep copy via System.Text.Json

// Numeric (int / long / double)
7.IsPrime();                             // true
5.Factorial();                           // 120
1234.ToDigits();                         // [1, 2, 3, 4]
42.IsBetween(1, 100);                    // true
double.NaN.IsNaN();                      // true
3.14d.RoundTo(1);                        // 3.1

// Numeric (decimal)
1234.56m.ToCurrencyString("en-US");      // "$1,234.56"
150m.Clamp(0m, 100m);                    // 100
25m.Percentage(200m);                    // 12.5
(-42.5m).Abs();                          // 42.5

// Char
'a'.IsVowel();                           // true
'Z'.IsConsonant();                        // true
'5'.IsAsciiDigit();                       // true

// Identifiers (Guid)
Guid.Empty.IsEmpty();                    // true
Guid.NewGuid().ToShortString();          // 22-char Base64URL
Guid.NewComb();                          // time-ordered GUID

// Durations (TimeSpan)
TimeSpan.FromSeconds(-5).Abs();          // 00:00:05
5.Days() + 3.Hours();                    // 5.03:00:00
10.Minutes().ToHumanReadable();          // "10 minutes"

// Streams
byte[] data = File.ReadAllBytes("file.bin");
byte[] compressed = data.CompressGzip();
byte[] back = compressed.DecompressGzip();

// Async
await SomeWork().FireAndForget();
await SomeWork().WithTimeout(TimeSpan.FromSeconds(5));
await SomeWork().Retry(maxAttempts: 3, delay: TimeSpan.FromMilliseconds(500));

// Collections (Stack)
var stack = new Stack<int>();
stack.PushRange(new[] { 1, 2, 3 });   // top = 3
stack.PeekOrDefault(-1);               // 3 (no remove)
stack.PopMany(2);                      // [3, 2]
stack.Clone();                         // independent copy

// Collections (Queue)
var queue = new Queue<string>();
queue.EnqueueRange(new[] { "a", "b", "c" });
queue.PeekOrDefault("(empty)");        // "a" (no remove)
queue.DequeueMany(2);                  // ["a", "b"]
queue.Clone();                         // independent copy

πŸ—οΈ Project Structure

Oxtensions.sln
β”œβ”€β”€ src/
β”‚   └── Oxtensions/
β”‚       β”œβ”€β”€ String/      StringExtensions.cs
β”‚       β”œβ”€β”€ Byte/        ByteExtensions.cs
β”‚       β”œβ”€β”€ Char/        CharExtensions.cs
β”‚       β”œβ”€β”€ Date/
β”‚       β”‚   β”œβ”€β”€ DateTime/       DateTimeExtensions.cs
β”‚       β”‚   β”œβ”€β”€ DateOnly/       DateOnlyExtensions.cs
β”‚       β”‚   └── DateTimeOffset/ DateTimeOffsetExtensions.cs
β”‚       β”œβ”€β”€ Collections/
β”‚       β”‚   β”œβ”€β”€ List/        ListExtensions.cs
β”‚       β”‚   β”œβ”€β”€ Dictionary/  DictionaryExtensions.cs
β”‚       β”‚   β”œβ”€β”€ Stack/       StackExtensions.cs
β”‚       β”‚   └── Queue/       QueueExtensions.cs
β”‚       β”œβ”€β”€ DataTable/   DataTableExtensions.cs
β”‚       β”œβ”€β”€ Enum/        EnumExtensions.cs
β”‚       β”œβ”€β”€ Generic/     GenericExtensions.cs
β”‚       β”œβ”€β”€ Guid/        GuidExtensions.cs
β”‚       β”œβ”€β”€ TimeSpan/
β”‚       β”‚   β”œβ”€β”€ TimeSpanExtensions.cs
β”‚       β”‚   β”œβ”€β”€ IntDurationExtensions.cs
β”‚       β”‚   └── LongDurationExtensions.cs
β”‚       β”œβ”€β”€ Stream/
β”‚       β”‚   β”œβ”€β”€ StreamExtensions.cs
β”‚       β”‚   └── ByteStreamExtensions.cs
β”‚       β”œβ”€β”€ Async/       TaskExtensions.cs
β”‚       └── Numeric/
β”‚           β”œβ”€β”€ Int/     IntExtensions.cs
β”‚           β”œβ”€β”€ Long/    LongExtensions.cs
β”‚           β”œβ”€β”€ Double/  DoubleExtensions.cs
β”‚           └── Decimal/ DecimalExtensions.cs
└── tests/
    └── Oxtensions.Tests/
        β”œβ”€β”€ String/      StringExtensionsTests.cs
        β”œβ”€β”€ Byte/        ByteExtensionsTests.cs
        β”œβ”€β”€ Char/        CharExtensionsTests.cs
        β”œβ”€β”€ Date/        DateTimeExtensionsTests.cs
        β”‚               DateOnlyExtensionsTests.cs
        β”‚               DateTimeOffsetExtensionsTests.cs
        β”œβ”€β”€ Collections/ ListExtensionsTests.cs
        β”‚               DictionaryExtensionsTests.cs
        β”‚               StackExtensionsTests.cs
        β”‚               QueueExtensionsTests.cs
        β”œβ”€β”€ DataTable/   DataTableExtensionsTests.cs
        β”œβ”€β”€ Enum/        EnumExtensionsTests.cs
        β”œβ”€β”€ Generic/     GenericExtensionsTests.cs
        β”œβ”€β”€ Guid/        GuidExtensionsTests.cs
        β”œβ”€β”€ TimeSpan/    TimeSpanExtensionsTests.cs
        β”œβ”€β”€ Stream/      StreamExtensionsTests.cs
        β”œβ”€β”€ Async/       TaskExtensionsTests.cs
        └── Numeric/
            β”œβ”€β”€ IntExtensionsTests.cs
            β”œβ”€β”€ LongExtensionsTests.cs
            β”œβ”€β”€ DoubleExtensionsTests.cs
            └── DecimalExtensionsTests.cs

πŸ§ͺ Running Tests

# All frameworks
dotnet test

# Specific framework
dotnet test --framework net10.0

# Specific class
dotnet test --filter "ClassName=StringExtensionsTests"

Test coverage: 676 tests across 5 frameworks (net6.0 Β· net7.0 Β· net8.0 Β· net9.0 Β· net10.0)


πŸ”§ Engineering Highlights

  • Zero-allocation paths β€” ArrayPool<T>, stackalloc, string.Create, Span<T> throughout
  • Reflection cache β€” ConcurrentDictionary<Type, ...> in DataTableExtensions and EnumExtensions
  • Span-based parsing β€” all TryParse calls use .AsSpan() overloads
  • Pre-compiled regex β€” all regex patterns are static readonly with RegexOptions.Compiled
  • Thread-safe β€” stateless extension methods; no shared mutable state
  • Nullable-aware β€” #nullable enable on all files, null-safe public APIs

πŸ“„ License

MIT Β© 2026 Oxara

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  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.
  • net10.0

    • No dependencies.
  • net6.0

  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.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
1.1.0 109 2/24/2026