Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Most standard approach for returning results in an api

$
0
0

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.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>