What interface should my service return? IQueryable, IList, IEnumerable?

后端 未结 7 2216
孤独总比滥情好
孤独总比滥情好 2021-01-31 23:26

Imagine I have a SearchService layer that has a method to search all cars starting with a certain string;

public static class Searcher{
    public IAnInterface&l         


        
7条回答
  •  醉酒成梦
    2021-01-31 23:34

    I would choose IEnumerable because it has a more central place in the framework, providing versatility for those that need it, while also providing familiarity to those who are yet to get stuck into things like LINQ.

提交回复
热议问题