BetterTasks 1.0.2

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

BetterTasks

A rewrite of the C# Task system. Performs about 10% faster than the built-in Task system.

Installation

Add the .dll file as a dependency for your project.

Usage

Import the package:

using BetterTasks;

There are two ways to create and run a BetterTask:

BetterTask task = new BetterTask(() => Console.WriteLine("Hello World!"));
task.Start();

or

BetterTask task = BetterTask.Run(() => Console.WriteLine("Hello World!"));

BetterTask is designed to work as similarly as possible to Task. .ContinueWith(Action action) and .Wait() both work. However, it has a few extra features:

Passing the Task as a Parameter<br> When passing a delegate to a BetterTask, it can take a parameter that will be the BetterTask.

BetterTask.Run((task) => Console.WriteLine(task));

Abort<br> BetterTask can be aborted with the .Abort() method.

Cancel<br> BetterTask can be cancelled with the .Cancel() method. The IsCanceled property will be true after this method is called. Actions should check if IsCanceled is true and shut down if it is.

ForceCancel<br> The .ForceCancel(int timeout = 2000) method calls .Cancel(), then after timeout milliseconds, if the task has not shut down, calls .Abort().

Task Priority<br> BetterTask's constructors have an optional parameter, priority, of type ThreadPriority, which defaults to ThreadPriority.Normal. Whichever thread executes the task will be set to this priority while executing the task.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.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.0.2 163 3/13/2024
1.0.0 139 3/13/2024