title: How to return a string from async
body: <p>My method is calling a web service and working asynchronusly.</p>
  
  <p>When getting response, everything works fine and I am getting my response.</p>
  
  <p>The problem starts when I need to return this response.</p>
  
  <p>here is the code of my method:</p>
  
  <pre><code> public async Task&lt;string&gt; sendWithHttpClient(string requestUrl, string json)
          {
              try
              {
                  Uri requestUri = new Uri(requestUrl);
                  using (var client = new HttpClient())
                  {
                      client.DefaultRequestHeaders.Clear();
                      ...//adding things to header and creating requestcontent
                      var response = await client.PostAsync(requestUri, requestContent);
  
                      if (response.IsSuccessStatusCode)
                      {
  
                          Debug.WriteLine("Success");
                          HttpContent stream = response.Content;
                          //Task&lt;string&gt; data = stream.ReadAsStringAsync();    
                          var data = await stream.ReadAsStringAsync();
                          Debug.WriteLine("data len: " + data.Length);
                          Debug.WriteLine("data: " + data);
                          return data;                       
                      }
                      else
                      {
                          Debug.WriteLine("Unsuccessful!");
                          Debug.WriteLine("response.StatusCode: " + response.StatusCode);
                          Debug.WriteLine("response.ReasonPhrase: " + response.ReasonPhrase);
                          HttpContent stream = response.Content;    
                          var data = await stream.ReadAsStringAsync();
                          return data;
                       }
                  }
              }
              catch (Exception ex)
              {
                  Debug.WriteLine("ex: " + ex.Message);
                  return null;
              }
  </code></pre>
  
  <p>and I am calling it this way:</p>
  
  <pre><code>      Task &lt;string&gt; result =  wsUtils.sendWithHttpClient(fullReq, "");           
        Debug.WriteLine("result:: " + result); 
  </code></pre>
  
  <p>but when printing result I am seeing something like this: <code>System.Threading.Tasks.Task</code></p>
  
  <p>how can I get the result string as I did with <em>data</em> inside my method.</p>