Most standard approach for returning results in an api RRS feed

  • Question

  • User-1204637165 posted

    Ok so normally I write my apis like this

      public IEnumerable<WeatherForecast> Get()

    but of recent I saw a couple of my .net friends use the ActionResult. Some thing like this below

      public ActionResult<IEnumerable<WeatherForecast>> Get()

    Ok so is it a better coding practice to use ActionResult.  Please enlighten me. I dont use this till now and my api works fine. But I am very curious on best coding practice.

    Cos I know on the international level this is what makes a developer stand out  from the baby programmers.

    Tuesday, April 7, 2020 10:40 PM