Dev.Util.Tasks
1.2.4
See the version list below for details.
dotnet add package Dev.Util.Tasks --version 1.2.4
NuGet\Install-Package Dev.Util.Tasks -Version 1.2.4
<PackageReference Include="Dev.Util.Tasks" Version="1.2.4" />
<PackageVersion Include="Dev.Util.Tasks" Version="1.2.4" />
<PackageReference Include="Dev.Util.Tasks" />
paket add Dev.Util.Tasks --version 1.2.4
#r "nuget: Dev.Util.Tasks, 1.2.4"
#:package Dev.Util.Tasks@1.2.4
#addin nuget:?package=Dev.Util.Tasks&version=1.2.4
#tool nuget:?package=Dev.Util.Tasks&version=1.2.4
Dev.Util.Tasks
Resilience and flow control utilities for the Dev.Util ecosystem. Manage async execution, retries, and rate limiting with ease.
📦 Installation
dotnet add package Dev.Util.Tasks
✨ Features
- 🔄 Resilience (Retry): Robust retry policies with backoff for unstable operations.
- 🚀 Concurrency:
ForEachAsyncfor controlled parallel processing. - 🔥 Fire & Forget: Safely execute background tasks without blocking or crashing.
- ⏳ Timeouts: Enforce execution limits on any
Task. - 📉 Rate Limiting:
DebounceandThrottlefor UI events or API pressure.
🛠 Usage Examples
1. Robust Retry Logic
Handle transient failures in network calls or DB operations.
using Dev.Util.Tasks;
// Retry 3 times with a 1-second delay between attempts
await Retry.DoAsync(async () =>
{
return await api.GetLargeData();
}, TimeSpan.FromSeconds(1), retryCount: 3);
2. Controlled Parallelism
Process a collection concurrently without overwhelming the system.
using Dev.Util.Tasks;
var imageLinks = GetLinks();
// Process images 5 at a time
await imageLinks.ForEachAsync(async link =>
{
await DownloadImage(link);
}, maxDegreeOfParallelism: 5);
3. Task Timeouts
Prevent your application from hanging on stalled tasks.
using Dev.Util.Tasks;
try
{
await ExternalService.Call().WithTimeout(TimeSpan.FromSeconds(10));
}
catch (TimeoutException)
{
// Handle slow connection
}
4. UI/Event Rate Limiting
Essential for search bars or frequent UI updates.
using Dev.Util.Tasks;
// Debounce: Wait for 300ms of "silence" before searching
var debouncedSearch = ActionExtensions.Debounce<string>(term =>
{
PerformSearch(term);
}, 300);
// Throttle: Limit execution to once per second
var throttledClick = ActionExtensions.Throttle(() =>
{
SubmitData();
}, 1000);
5. Safe Fire & Forget
Run background work without the "Async Void" pitfalls.
using Dev.Util.Tasks;
// Runs in background. Exceptions are passed to the handler instead of crashing.
ProcessDataAsync().FireAndForget(ex =>
{
Logger.LogError(ex);
});
Dev.Util.Tasks respects CancellationToken throughout its API for proper resource cleanup.
| 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 was computed. 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 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. 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. |
-
.NETStandard 2.0
- Dev.Util.Core (>= 1.2.4)
-
net8.0
- Dev.Util.Core (>= 1.2.4)
-
net9.0
- Dev.Util.Core (>= 1.2.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Dev.Util.Tasks:
| Package | Downloads |
|---|---|
|
Dev.Util
The complete Dev.Util ecosystem for .NET. One package to rule them all. Provides access to Core, Collections, IO, Security, Web, Reflection, Tasks, and Json modules. |
GitHub repositories
This package is not used by any popular GitHub repositories.