First()
/Last()
on LinkedList<T>
CS-P1024The methods First()
and Last()
come from the Enumerable
interface defined in System.Linq
.
While they may be appropriate for other structures and scenarios, they are not performant for LinkedList<T>
.
Consider using LinkedList<T>
's own properties First
and Last
as they're efficient and tailored for this very purpose.
var first = list.First();
var first = list.First;