mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
14 lines
420 B
C#
14 lines
420 B
C#
using System.Reactive.Disposables;
|
|
using System.Threading;
|
|
|
|
namespace Artemis.UI.Extensions;
|
|
|
|
public static class CompositeDisposableExtensions
|
|
{
|
|
public static CancellationToken AsCancellationToken(this CompositeDisposable disposable)
|
|
{
|
|
CancellationTokenSource tokenSource = new();
|
|
Disposable.Create(tokenSource, s => s.Cancel()).DisposeWith(disposable);
|
|
return tokenSource.Token;
|
|
}
|
|
} |