Example #1
0
        private async void Button_Click(object sender, System.EventArgs e)
        {
            var c  = new AsyncSleepyMethods();
            var sw = new Stopwatch();

            sw.Start();

            textView.Text += await c.CallSleepyComplicatedAwaiting();

            textView.Text += $"sw:{sw.ElapsedMilliseconds} " + System.Environment.NewLine;
            sw.Restart();

            ///////////////////////////////////////////////
            sw.Stop();

            textView.Text += "ready all " + System.Environment.NewLine;
        }
Example #2
0
        private static void Main(string[] args)
        {
            var sw = new Stopwatch();
            var mc = new AsyncSleepyMethods();

            sw.Start();

            var s = mc.CallSleepyComplicatedAwaiting().Result;

            Console.WriteLine(s);
            Console.WriteLine($"sw:{sw.ElapsedMilliseconds}");
            sw.Restart();

            ///////////////////////////////////////////////
            sw.Stop();

            Console.WriteLine("ready all");
            Console.ReadKey();
        }