static void Main()
    {
        Simple ds = new Simple();

        ds.DoRun();
        Console.Read();
    }
Esempio n. 2
0
        public void demo4()
        {
            CancellationTokenSource cts = new CancellationTokenSource();
            CancellationToken       ct  = cts.Token;
            Simple s = new Simple();

            s.DoRun(ct);
            Thread.Sleep(500);
            cts.Cancel();
            Console.WriteLine("end");
            Thread.Sleep(2000);
        }