NuExt.System
0.7.1
Prefix Reserved
See the version list below for details.
dotnet add package NuExt.System --version 0.7.1
NuGet\Install-Package NuExt.System -Version 0.7.1
<PackageReference Include="NuExt.System" Version="0.7.1" />
<PackageVersion Include="NuExt.System" Version="0.7.1" />
<PackageReference Include="NuExt.System" />
paket add NuExt.System --version 0.7.1
#r "nuget: NuExt.System, 0.7.1"
#:package NuExt.System@0.7.1
#addin nuget:?package=NuExt.System&version=0.7.1
#tool nuget:?package=NuExt.System&version=0.7.1
NuExt.System
NuExt.System is a lightweight, production-ready foundation for everyday .NET development. It brings together high-quality utilities for asynchrony, lifetime management, threading primitives, high‑performance spans/memory helpers, diagnostics, and collection helpers — all with a strong focus on performance, correctness, and developer ergonomics. Use it to reduce boilerplate, standardize common patterns across projects, and keep code fast and clean across modern .NET and .NET Framework.
Features
- Asynchrony & lifetime
- Async locks and wait handles:
AsyncLock,ReentrantAsyncLock,AsyncWaitHandle - Disposable tooling:
Disposable,AggregateDisposable,AsyncDisposable,AggregateAsyncDisposable,AsyncLifetime
- Async locks and wait handles:
- Threading & synchronization
- Reentrant async lock (context‑aware), synchronization‑context helpers, thread‑affine flows
- High‑performance spans & memory
- Backports/polyfills for
Span/MemoryExtensionsAPIs (see below) ValueStringBuilder/ValueListBuilder<T>for zero‑allocation building
- Backports/polyfills for
- Collections & equality
ObservableDictionary<TKey, TValue>,ReferenceEqualityComparer(polyfill),ArrayEqualityComparer<T>, and many useful extension helpers
- I/O & paths (cross‑platform)
PathBuilder(class,IDisposable) andValuePathBuilder(ref struct) — platform‑independent path buildersPathUtilities— static helpers for common path operations
- Diagnostics & utilities
ProcessMonitor,PerformanceMonitor,EnumHelper<T>,TypeExtensions, etc.
Span / MemoryExtensions Polyfills
This package includes polyfills (API backports) for selected Span / MemoryExtensions‑style APIs from newer .NET versions. On modern runtimes, it transparently uses the inbox implementations; on older runtimes, it provides compatible behavior with the same semantics.
What you get (highlights)
- Search & comparison:
Contains,SequenceEqual(+IEqualityComparer<T>) - Indexing:
IndexOf,LastIndexOf(element / sequence) - Set‑based search:
IndexOfAny,LastIndexOfAny,IndexOfAnyExcept,LastIndexOfAnyExcept - Range‑based:
IndexOfAnyInRange,IndexOfAnyExceptInRange,LastIndexOfAnyInRange,LastIndexOfAnyExceptInRange - Utilities:
StartsWith,EndsWith,Replace(in‑place / copy),Count,CountAny
Notes
- Allocation‑free, performance‑oriented; value types use bitwise fast paths where applicable.
- Semantics mirror the .NET runtime APIs; custom comparers are honored when provided.
Why NuExt.System?
- Practical — battle‑tested building blocks you use every day
- Fast — zero‑alloc paths, tight loops, careful branching profiles
- Consistent — same behavior across modern .NET and .NET Framework
- Focused — no heavy external dependencies or configuration
Compatibility
- .NET Standard 2.0+, .NET 8/9/10 and .NET Framework 4.6.2+
- Works across desktop, web, and services (Console, ASP.NET Core, Avalonia, WinUI, WPF, WinForms)
Commonly Used Types
- Asynchrony & lifetime
System.Threading.AsyncLock,System.Threading.ReentrantAsyncLock,System.Threading.AsyncWaitHandleSystem.ComponentModel.Disposable,AggregateDisposable,AsyncDisposable,AggregateAsyncDisposable,AsyncLifetime
- Collections & equality
System.Collections.ObjectModel.ObservableDictionary<TKey, TValue>System.Collections.Generic.ValueListBuilder<T>System.Collections.Generic.ReferenceEqualityComparer(polyfill)System.Collections.Generic.ArrayEqualityComparer<T>- Various extension helpers (collections, delegates, enums, strings, exceptions)
- Strings, spans, and memory
System.Text.ValueStringBuilderSystem.CompatMemoryExtensions(polyfills/backports)
- I/O & paths (cross‑platform)
System.IO.PathBuilder(class,IDisposable— mutable path builder)System.IO.ValuePathBuilder(ref struct — high‑performance mutable path builder)System.IO.PathUtilities(static common path operations)
- Diagnostics & helpers
System.Diagnostics.ProcessMonitor,PerformanceMonitorSystem.EnumHelper<T>,System.FormatUtils,System.HexConverter
Quick examples
1) Reentrant async lock (with ExecutionContext best practices)
var asyncLock = new System.Threading.ReentrantAsyncLock();
var cts = new CancellationTokenSource();
// Synchronous section
asyncLock.Acquire(() =>
{
// do work safely, reentry allowed on the same flow
});
// Asynchronous section
await asyncLock.AcquireAsync(async () =>
{
await DoAsyncWork();
});
// Avoid unintentionally flowing AsyncLocal into CT callbacks:
using (ExecutionContext.SuppressFlow())
{
cts.Token.Register(() => asyncLock.Acquire(() =>
{
// safe callback body
}));
}
2) Async lifetime + aggregated disposal
var lifetime = new System.AsyncLifetime() { ContinueOnCapturedContext = true };
lifetime.AddDisposable(new FileStream(path, FileMode.Open));
lifetime.AddAsync(async () => await FlushBuffersAsync());
await lifetime.DisposeAsync(); // disposes in the right order, async‑aware
3) Zero‑alloc string building with ValueStringBuilder
Span<char> initial = stackalloc char[128];
var sb = new System.Text.ValueStringBuilder(initial);
sb.Append("User: ");
sb.Append(userName);
sb.Append(", Items: ");
sb.Append(itemCount);
string result = sb.ToString(); // minimal allocations
4) ValueListBuilder<T> and ValueTask.WhenAll
public class Example
{
public static async Task Main()
{
int failed = 0;
String[] urls = [ "www.adatum.com", "www.cohovineyard.com",
"www.cohowinery.com", "www.northwindtraders.com",
"www.contoso.com" ];
var tasks = new ValueListBuilder<ValueTask>(urls.Length);
foreach (var value in urls)
{
var url = value;
tasks.Append(new ValueTask(Task.Run(() =>
{
var png = new Ping();
try
{
var reply = png.Send(url);
if (reply.Status != IPStatus.Success)
{
Interlocked.Increment(ref failed);
throw new TimeoutException("Unable to reach " + url + ".");
}
}
catch (PingException)
{
Interlocked.Increment(ref failed);
throw;
}
})));
}
ValueTask t = ValueTask.WhenAll(tasks.ToArray());
try
{
await t;
}
catch { }
if (t.IsCompletedSuccessfully)
Console.WriteLine("All ping attempts succeeded.");
else if (t.IsFaulted)
Console.WriteLine("{0} ping attempts failed", failed);
}
}
5) ValueListBuilder<T> and ValueTask.WhenAll<TResult>
public class Example
{
public static async Task Main()
{
int failed = 0;
String[] urls = [ "www.adatum.com", "www.cohovineyard.com",
"www.cohowinery.com", "www.northwindtraders.com",
"www.contoso.com" ];
var tasks = new ValueListBuilder<ValueTask<PingReply>>(urls.Length);
foreach (var value in urls)
{
var url = value;
tasks.Append(new ValueTask<PingReply>(Task.Run(() =>
{
var png = new Ping();
try
{
var reply = png.Send(url);
if (reply.Status != IPStatus.Success)
{
Interlocked.Increment(ref failed);
throw new TimeoutException("Unable to reach " + url + ".");
}
return reply;
}
catch (PingException)
{
Interlocked.Increment(ref failed);
throw;
}
})));
}
try
{
PingReply[] replies = await ValueTask.WhenAll(tasks.ToArray());
Console.WriteLine("{0} ping attempts succeeded:", replies.Length);
for (int i = 0; i < replies.Length; i++)
{
var reply = replies[i];
Console.WriteLine($"Reply from {reply.Address}: bytes={reply.Buffer.Length} time={reply.RoundtripTime}ms TTL={reply.Options?.Ttl} [{urls[i]}]");
}
}
catch (AggregateException)
{
Console.WriteLine("{0} ping attempts failed", failed);
}
}
}
Installation
Via NuGet:
dotnet add package NuExt.System
Or via Visual Studio:
- Go to
Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution.... - Search for
NuExt.System. - Click "Install".
Ecosystem
- NuExt.Minimal.Mvvm
- NuExt.Minimal.Mvvm.SourceGenerator
- NuExt.Minimal.Behaviors.Wpf
- NuExt.Minimal.Mvvm.Wpf
- NuExt.Minimal.Mvvm.MahApps.Metro
- NuExt.System.Data
- NuExt.System.Data.SQLite
Notes & acknowledgements
Some implementations are derived from the .NET Runtime (MIT). See LICENSE and source comments for attributions.
Contributing
Issues and PRs are welcome. Keep changes minimal and performance-conscious.
License
MIT. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 is compatible. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Microsoft.Bcl.HashCode (>= 6.0.0)
- System.Text.Json (>= 10.0.3)
-
.NETFramework 4.7.1
- Microsoft.Bcl.HashCode (>= 6.0.0)
- System.Text.Json (>= 10.0.3)
-
.NETStandard 2.0
- Microsoft.Bcl.HashCode (>= 6.0.0)
- System.Text.Json (>= 10.0.3)
-
.NETStandard 2.1
- System.Text.Json (>= 10.0.3)
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on NuExt.System:
| Package | Downloads |
|---|---|
|
NuExt.DevExpress.Mvvm
Provides extensions and utilities for the DevExpress MVVM Framework with a focus on asynchronous operations in WPF. Improves async workflow handling, enhances ViewModel infrastructure, and offers async‑aware services that simplify building responsive MVVM applications. |
|
|
NuExt.System.Data
1High‑level data access utilities for .NET, providing extensions for DataReader, DataRow, and DataTable, plus lightweight DAL helpers, DbConverter, and IDbContext abstractions. Designed to simplify common database operations and improve consistency across data access layers. |
|
|
NuExt.Minimal.Mvvm.Wpf
NuExt.Minimal.Mvvm.Wpf is an extension for the lightweight MVVM framework NuExt.Minimal.Mvvm, specifically designed for WPF applications. Commonly Used Types: Minimal.Mvvm.ModelBase Minimal.Mvvm.Wpf.ControlViewModel Minimal.Mvvm.Wpf.DocumentContentViewModelBase Minimal.Mvvm.Wpf.WindowViewModel Minimal.Mvvm.Wpf.IAsyncDialogService Minimal.Mvvm.Wpf.IAsyncDocument Minimal.Mvvm.Wpf.IAsyncDocumentContent Minimal.Mvvm.Wpf.IAsyncDocumentManagerService Minimal.Mvvm.Wpf.InputDialogService Minimal.Mvvm.Wpf.OpenWindowsService Minimal.Mvvm.Wpf.SettingsService Minimal.Mvvm.Wpf.TabbedDocumentService Minimal.Mvvm.Wpf.ViewLocator Minimal.Mvvm.Wpf.WindowedDocumentService Minimal.Mvvm.Wpf.WindowPlacementService |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.3 | 264 | 3/15/2026 |
| 0.7.2 | 180 | 3/2/2026 |
| 0.7.1 | 99 | 2/24/2026 |
| 0.7.0 | 198 | 2/12/2026 |
| 0.6.0 | 272 | 1/11/2026 |
| 0.5.2 | 399 | 12/15/2025 |
| 0.5.1 | 324 | 12/14/2025 |
| 0.4.1 | 550 | 12/10/2025 |
| 0.4.0 | 284 | 12/5/2025 |
| 0.3.5 | 359 | 6/13/2025 |
| 0.3.4 | 327 | 3/6/2025 |
| 0.3.3 | 466 | 2/21/2025 |
| 0.3.2 | 444 | 1/22/2025 |
| 0.3.1 | 408 | 1/19/2025 |
| 0.3.0 | 416 | 1/13/2025 |
| 0.2.0 | 387 | 11/14/2024 |