title: Which return type to use for an action method that can return an anonymous type, but also HTTP status codes?
body: <p>I see that there are multiple ways I can return data in Asp.Net Core controller when various results are possible:</p>
  
  <p>1) <code>object</code></p>
  
  <pre><code>[HttpPost]
  public object RefreshToken()
  {
      if (Validate())
      {
          return new
                 {
                     token = CreateToken()
                 };
      }
  
      return HttpUnauthorized()
  }
  </code></pre>
  
  <p>2) <code>dynamic</code></p>
  
  <pre><code>[HttpPost]
  public dynamic RefreshToken()
  {
      if (Validate())
      {
          return new
                 {
                     token = CreateToken()
                 };
      }
  
      return HttpUnauthorized()
  }
  </code></pre>
  
  <p>3) <code>IActionResult</code></p>
  
  <pre><code>[HttpPost]
  public IActionResult RefreshToken()
  {
      if (Validate())
      {
                  return new ObjectResult(new
                  {
                      token = CreateToken()
                  });
      }
  
      return HttpUnauthorized()
  }
  </code></pre>
  
  <p>Are there any differences with these 3 approaches? Which one should be preferred?</p>