What is the difference between declaring WEB API methods as the following :
public async Task<IActionResult> Get() {}
public ActionResult<IEnumerable<string>> Get()
What is the difference between declaring WEB API methods as the following :
public async Task<IActionResult> Get() {}
public ActionResult<IEnumerable<string>> Get()
Method 1 is an asynchronous API Action, returning a simple ActionResult, which is a base type for action method return types.
Method 2 is a synchronous API action, returning a generic IActionResult type that encapsulates a collection of strings.
Considering the method names Get
, they are the kind of APIs that you would call to get some data from a web server.
Does this answer the question?