How to return both custom HTTP status code and content?
<p>I have an WebApi Controller written in ASP.NET Core and would like to return a custom HTTP status code along with custom content. </p>

<p>I am aware of: </p>

<pre><code>return new HttpStatusCode(myCode)
</code></pre>

<p>and </p>

<pre><code>return Content(myContent)
</code></pre>

<p>and I am looking for something along the lines of:</p>

<pre><code>return Content(myCode, myContent)
</code></pre>

<p>or some in built mechanism that already does that. So far I have found this solution: </p>

<pre><code>var contentResult = new Content(myContent);
contentResult.StatusCode = myCode;
return contentResult;
</code></pre>

<p>is another recommended way of achieving this?</p>