rspec/rules/S6613/why-dotnet.adoc

9 lines
644 B
Plaintext

== Why is this an issue?
Both the `Enumerable.First` extension method and the `LinkedList<T>.First` property can be used to find the first value in a `LinkedList<T>`. However, `LinkedList<T>.First` is much faster than `Enumerable.First`. For small collections, the performance difference may be minor, but for large collections, it can be noticeable. The same applies for the `Last` property as well.
*Applies to:*
* https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.linkedlist-1.first[LinkedList<T>.First]
* https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.linkedlist-1.last[LinkedList<T>.Last]