ContentResult
ContentResult is a class in the ASP.NET Core MVC framework that represents an action method result. It is used to return content of a specific type to the client, such as plain text, HTML, or JSON. The ContentResult class inherits from the ActionResult class, which is the base class for all action method results.
To use ContentResult, you create an instance of the class and set its Content and ContentType properties.
Here's a simple example of how to use ContentResult in an ASP.NET Core MVC controller:
{
return Content("Hello, World!", "text/plain");
}
This action method will return the string "Hello, World!" as plain text to the client.
ContentResult is useful when you need to return custom content from an action method that is not