Example #1
0
        static void Main(string[] args)
        {
            var watch = System.Diagnostics.Stopwatch.StartNew();

            MainAsync(args).GetAwaiter().GetResult();
            watch.Stop();
            Console.WriteLine($"Async time: {watch.ElapsedMilliseconds}");

            watch = System.Diagnostics.Stopwatch.StartNew();
            var threadedClass = new ThreadClass();

            threadedClass.DownloadSomeSites();
            watch.Stop();
            Console.WriteLine($"Sync time: {watch.ElapsedMilliseconds}");

            watch = System.Diagnostics.Stopwatch.StartNew();
            var threadedClassMultiThread = new ThreadClass();

            threadedClass.DownloadSomeSitesMultiThread();
            watch.Stop();
            Console.WriteLine($"Multithread time: {watch.ElapsedMilliseconds}");

            Console.ReadLine();
        }
Example #2
0
 static async Task MainAsync(string[] args)
 {
     var threadedClass = new ThreadClass();
     await threadedClass.DownloadSomeSitesAsync();
 }