LuminTask 1.0.6
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.1
This package targets .NET Standard 2.1. The package is compatible with this framework or higher.
dotnet add package LuminTask --version 1.0.6
NuGet\Install-Package LuminTask -Version 1.0.6
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="LuminTask" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LuminTask" Version="1.0.6" />
<PackageReference Include="LuminTask" />
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 LuminTask --version 1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LuminTask, 1.0.6"
#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 LuminTask@1.0.6
#: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=LuminTask&version=1.0.6
#tool nuget:?package=LuminTask&version=1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
LuminTask
LuminTask 是一个面向 .NET 的高性能异步任务库,为 C# 提供可直接用于 async / await 的 LuminTask 与 LuminTask<T> 类型。
项目通过自定义异步方法构建器、任务源池和非托管任务状态存储,减少高频异步路径中的托管堆分配。
项目公开 API 的命名空间是
LuminThread,NuGet 包名称是LuminTask。
主要特性
- 自定义
LuminTask与LuminTask<T>awaitable 类型 - 支持同步完成、异常、取消、延迟和让出执行权
- 支持
WhenAll、WhenAny、WhenEach等组合操作 - 支持
Task、ValueTask与LuminTask互操作 - 支持
CancellationToken.WaitAsync()异步桥接 - 提供异步锁、信号量、事件、倒计时和懒加载工具
- 支持 .NET Standard 2.1、.NET 8 和 .NET 9
安装
dotnet add package LuminTask --version 1.0.2
快速开始
using LuminThread;
static async LuminTask<int> CalculateAsync()
{
await LuminTask.Yield();
return 42;
}
var result = await CalculateAsync();
using LuminThread.Utility;
LuminTask<int> task = new ValueTask<int>(42).AsLuminTask();
await cancellationToken.WaitAsync(completeAsCanceled: true);
await task.WaitAsync(TimeSpan.FromSeconds(5), cancellationToken);
使用注意
LuminTask 遵循类似 ValueTask 的单次消费约定:一个任务实例应被 await 或 Forget() 消费一次,不应重复等待同一个实例。
许可证
本项目基于 MIT License 发布。
早期实现中曾学习并借鉴过 UniTask(MIT,作者 Cysharp)的设计思路,部分异步同步原语(AsyncEx 系列)也参考了 AsyncEx(MIT,作者 Stephen Cleary)的思想。
| 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- System.Runtime.CompilerServices.Unsafe (>= 6.1.2)
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on LuminTask:
| Package | Downloads |
|---|---|
|
LuminUI
Zero-allocation hot-path MVR UI framework with compile-time reactive binding. |
GitHub repositories
This package is not used by any popular GitHub repositories.