Collection Performance: Finding First or Last and Count
Many developers use LINQ methods such as First(), Last(), and Count() to interact with collections. However, these methods can be about 2.33× slower in performance compared to direct indexing. Caution is advised when using indexing to avoid exceptions, and consideration should be given to code readability versus performance.
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed