parent
9f0beec63a
commit
9c597aad90
1 changed files with 533 additions and 37 deletions
|
|
@ -0,0 +1,17 @@
|
|||
using System.Text;
|
||||
|
||||
namespace System.Threading.Tasks;
|
||||
|
||||
internal static class CancellationTokenSourceExtensions
|
||||
{
|
||||
public static Task CancelAsync(this CancellationTokenSource cancellationTokenSource)
|
||||
{
|
||||
if (cancellationTokenSource is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(cancellationTokenSource));
|
||||
}
|
||||
|
||||
cancellationTokenSource.Cancel();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue