.Net Asynchronous methods

   public class AsyncMethods
    {

        public async static Task<long?> GetPageLength()
        {

            var client = new HttpClient();

            var httpMessage = await client.GetAsync("http://apress.com");

            // Perform other actions while waiting for the HTTP request to complete
            return httpMessage.Content.Headers.ContentLength;
        }
    }

Leave a Reply

Your email address will not be published. Required fields are marked *