Ejemplo n.º 1
0
        public static async Task <long> TryAwaitCustomType(CancellationToken token)
        {
            MyAwaitable test = new MyAwaitable(token);
            var         ret  = await test;

            Console.WriteLine($"Awaitable type calculated {ret} value from long-running job!");
            return(ret);
        }
Ejemplo n.º 2
0
 public MyAwaiter(MyAwaitable awaitable)
 {
     _awaitable = awaitable;
     Task.Run(SetResult).ContinueWith(_ => awaitable.Finish());
 }