IEnumerable VS IList VS IQueryable

后端 未结 3 1785
无人及你
无人及你 2020-12-13 07:43

New to the MVC.net scene (and .net for that matter), but seems I find a wide array of options when wanting to populate a \"list\" with data. In my case at the moment, I\'d

3条回答
  •  有刺的猬
    2020-12-13 08:07

    Each interface has its own set of uses.

    IQueryable is for deferred queries (that is, it saves the query but only executes it when it is enumerated)

    IEnumerable can be enumerated and that's it.

    IList can have items added and removed.

提交回复
热议问题