using System;
using System.Threading;
public class Program
{
public static void Main()
var cts = new CancellationTokenSource();
var token = cts.Token;
cts.Cancel();
cts.Dispose();
token.Register(() => Console.WriteLine("I'm cancelled!"));
}