VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-removing-the-node-at-the-end-of-linkedlistt/

⇱ C# | Removing the node at the end of LinkedList<T> - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# | Removing the node at the end of LinkedList<T>

Last Updated : 11 Jul, 2025
LinkedList<T>.RemoveLast method is used to remove the node at the end of the LinkedList<T>. Syntax:
public void RemoveLast ();
Exception: The method throws InvalidOperationException if the LinkedList<T> is empty. Below given are some examples to understand the implementation in a better way: Example 1: Output:
The elements in LinkedList are : 
A
B
C
D
E
The elements in LinkedList are : 
A
B
C
D
Example 2:
Runtime Error:
Unhandled Exception: System.InvalidOperationException: The LinkedList is empty.
Note: This method is an O(1) operation. Reference:
Comment

Explore