Example #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);
        }
Example #2
0
 public MyAwaiter(MyAwaitable awaitable)
 {
     _awaitable = awaitable;
     Task.Run(SetResult).ContinueWith(_ => awaitable.Finish());
 }