Saturday, July 30, 2016

Writing async code in C# /URL to write C# application online and test them



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

public class AsyncSample
{
    static void Main()
    {
        GetURL().Wait();
    }

    private static async Task GetURL()
    {
        HttpClient client = new HttpClient();

        // This code executed asynchronously
        string response =
            await client.GetStringAsync(
            "http://jsonplaceholder.typicode.com/posts/1");

        // This code executed after
        // asynchronous code finalizes
        Console.WriteLine(response);
    }
}

https://www.microsoft.com/net