title: Is it possible to specify the response content inside a IHttpActionResult response to be strongly typed?
body: <p>It seems with WebAPI 2, your action method's content can be returned in any form.</p>
  
  <p>For example, this GET method works.</p>
  
  <pre><code>// GET api/values
  public IHttpActionResult Get(bool returnCarViewModel= true)
  {
      if (returnCarViewModel)
          return Ok(new CarViewModel());
      else
          return Ok(new AnimalViewModel());
  
  }
  </code></pre>
  
  <p>That seems like bad practice as now the caller must look inside the content of the method to see what type of object I'll be returning and even then, I can return different classes based on the logic I apply inside it.</p>
  
  <p>Is it possible to declare at compile time what the return type I should expect? Something  like... </p>
  
  <pre><code>public IHttpActionResult&lt;CarViewModel&gt; Get(bool returnCarViewModel= true)
  </code></pre>
  
  <p>I understand I can simply specify the return type to be CarViewModel but then I'll not be able to take advantage of the abstraction that IHttpActionResult offers</p>