.Net Async console demo

Here’s a quick demo of how to use async in a console.

using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace AsyncConsoleDemo
{
    public static class ConsoleDemo
    {
        static void Main(string[] args)
        {
            Console.WriteLine(ShowPageHead(new Uri("https://thecsharper.com/")));
            Console.WriteLine(ShowPageHead(new Uri("http://www.bbc.co.uk/")));
            Console.WriteLine(ShowPageHead(new Uri("https://www.google.com/")));
            Console.ReadKey();
        }

        static async Task<string> GetPageHead(Uri url)
        {
            using (var client = new HttpClient())
            {
                var fetchPage = client.GetStringAsync(url);
                var head = (await fetchPage).Substring(0, 100);
                return head;
            }
        }

        private static string ShowPageHead(Uri uri)
        {
            var headTask = GetPageHead(uri);
            return headTask.Result;
        }
    }
}