ActionResult<IEnumerable<Model>> vs IActionResult in ASP.NET Core WebAPI

Shervan360 1,541 Reputation points
2024-10-03T07:36:52.1066667+00:00

Hello,

What is the difference between ActionResult<IEnumerable<SpeakerModel>> vs IActionResult ?

I ran both of them and got the same result.

       public IActionResult GetAll()
       {
            return Ok(SpeakersList);
       }
          [HttpGet]
          public ActionResult<IEnumerable<SpeakerModel>> GetAll()
          {
               return Ok(SpeakersList);
          }
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,551 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
335 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.