VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-find-the-last-node-in-linkedlistt-containing-the-specified-value/

⇱ C# | Find the last node in LinkedList<T> containing the specified value - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# | Find the last node in LinkedList<T> containing the specified value

Last Updated : 11 Jul, 2025
LinkedList<T>.FindLast(T) method is used to find the last node that contains the specified value. Syntax:
public System.Collections.Generic.LinkedListNode<T> FindLast (T value);
Here, value is the value to locate in the LinkedList. Return Value: This method returns the last LinkedListNode<T> that contains the specified value, if found, otherwise, null. Below given are some examples to understand the implementation in a better way: Example 1: Output:
D
Example 2:
Runtime Error:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
Note:
  • The LinkedList is searched backward starting at Last and ending at First.
  • This method performs a linear search. Therefore, this method is an O(n) operation, where n is Count.
Reference:
Comment

Explore