title: What's the difference between Response.WriteAsync and returning a string
body: <p>Hi I was wandering if someone can explain to me the difference between these two methods for returning data from a controller.
  Is there an advantage or reason for using on method over the other?</p>
  
  <p>I am guessing that the returning function just calls <code>Response.WriteAsync</code> further down the line but I am not sure.</p>
  
  <p>Using postman both methods return the exact same response, so I was just curious about the two options, is there a reason for using one over the other or just personal preference.</p>
  
  <p>Between Response.WriteAsync:</p>
  
  <pre><code>[HttpGet("Fetch_WriteAsync")]
  public async Task Fetch_AsyncWrite()
  {
      HttpContext.Response.ContentType = "application/json";
      await HttpContext.Response.WriteAsync(JsonConvert.SerializeObject(new { data = "my_fetched_data" }));
  }
  </code></pre>
  
  <p>and just returning:</p>
  
  <pre><code>[HttpGet("Fetch_Return")]
  public async Task&lt;string&gt; Fetch_Return()
  {
      HttpContext.Response.ContentType = "application/json";
      return await Task.Factory.StartNew(()=&gt;JsonConvert.SerializeObject(new { data = "my_fetched_data" }));
  }
  </code></pre>