ASP.NET Core MVC is pretty flexible in terms of how it expects you to return results from the API actions. You could return an IActionResult, which gives you certain control over the status code and the nature of the response (i.e. object or a file or a status code only and so on). You could return a concrete object instance, and the framework will serialize it to the relevant response format. Finally, you could also return the new ActionResult<T> which allows you to mix both of the previous approaches in a single method, giving you the best of both worlds.
Let’s have a look at what happens in the framework when you return a null object instance and how you can change that behavior.