Introduction  HttpClient  is the library to Get, Post, Put,.. and call WebAPIs and it is very important to use it correctly.  This Library has some methods to call web apis which all of them are Async. It is really important to use them in async method but if you are using an Async method in a console application that does not have separate UI thread you can use it like the following code :      public  void  MySyncMethod() {     using (HttpClient client =  new  HttpClient())     {         client.BaseAddress =  new  Uri( "https://google.com" );         var  response  =  client.GetAsync( "SomeAddress" ) .ConfigureAwait( false ).GetAwaiter().GetResult();          if  ( response .IsSuccessStatusCode)         {             //Do Something...            }     } }     Using ConfigureAwait(false) is very important for the applications  which does not have separate UI thread   Creating HttpClient for each request is not a good Idea and  Reuse  Httpclient as much as possible...
 Introduction  HttpClient  is the library to Get, Post, Put,.. and call WebAPIs and it is very important to use it correctly.  This Library has some methods to call web apis which all of them are Async. It is really important to use them in async method but if you are using an Async method in a console application that does not have separate UI thread you can use it like the following code :      public  void  MySyncMethod() {     using (HttpClient client =  new  HttpClient())     {         client.BaseAddress =  new  Uri( "https://google.com" );         var  response  =  client.GetAsync( "SomeAddress" ) .ConfigureAwait( false ).GetAwaiter().GetResult();          if  ( response .IsSuccessStatusCode)         {             //Do Something...            }     } }     Using ConfigureAwait(false) is very important for the applications  which does not have separate UI thread   Creating HttpClient for each request is not a good Idea and  Reuse  Httpclient as much as possible...