question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API's Collection Return Type

See original GitHub issue

Currently the .NET API returns a List<T> for API calls that return a collection such as the Pipeline.ViewPipelineAsync method. Do you think this should be changed to something like IList<T> instead to mirror what was done for collections inside of the objects that are returned like Loan.CustomFields?

I suppose semantically it doesn’t matter as we’re unlikely to need to change the return type but the cohesiveness with the object’s collections seems beneficial. Thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jesse-weinstockcommented, Oct 25, 2017

changing my vote to List<>

0reactions
TylerBrinkleycommented, Oct 10, 2017

The thing is the deserializer Json.NET is already creating a List<T> so why not just expose it as such. See here. Then we’ll have a Count property and users will know they’re able to modify the collection as it’s created just for their call.

Read more comments on GitHub >

github_iconTop Results From Across the Web

what is the best collection type to return in an API
As I generally only return immutable (unmodifiable) objects from properties/methods, this answer assumes you want to do the same.
Read more >
Web API Return Types in ASP.NET Core
In this article, we are going to learn about different return types that we can use with ASP.NET Core Web API controller actions....
Read more >
Controller action return types in ASP.NET Core web API
The ActionResult types represent various HTTP status codes. Any non-abstract class deriving from ActionResult qualifies as a valid return type.
Read more >
The Web API action method can have following return types.
An action method can return primitive or other custom complex types as other normal methods. Consider the following Get action methods. Example: Primitive...
Read more >
Collection (Java Platform SE 8 )
Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found