concept void in category asp.net

appears as: void
ASP.NET Core in Action, Second Edition

This is an excerpt from Manning's book ASP.NET Core in Action, Second Edition.

Page handlers are typically named by convention, based on the HTTP verb that they respond to. They return either void, indicating that the Razor Page’s template should be rendered, or an IActionResult which contains other instructions for generating the response, redirecting the user to a different page, for example.

  • The handler returns Page() at the end of the method to indicate the associated Razor view should be rendered. The return statement is actually optional in this case; by convention, if the page handler is a void method, the Razor view will still be rendered, behaving as if you had called return Page() at the end of the method.