Is the Linq Count() faster or slower than List.Count or Array.Length?

前端 未结 7 567
你的背包
你的背包 2020-11-29 04:59

Is the LINQ Count() method any faster or slower than List<>.Count or Array.Length?

7条回答
  •  情话喂你
    2020-11-29 05:33

    The Enumerable.Count() method checks for ICollection, using .Count - so in the case of arrays and lists, it is not much more inefficient (just an extra level of indirection).

提交回复
热议问题