LinkedList<T>.RemoveFirst method is used to remove the node at the start of the LinkedList<T>.
public void RemoveFirst ();
Exception: The method throws InvalidOperationException if the LinkedList<T> is empty.
Below given are some examples to understand the implementation in a better way:
The elements in LinkedList are : A B C D E The elements in LinkedList are : B C D E
System.InvalidOperationException: The LinkedList is empty.
Note: This method is an O(1) operation.
- C# | Adding new node or value at the start of LinkedList<T>
- C# | Removing the specified node from the LinkedList<T>
- C# | Removing the node at the end of LinkedList<T>
- How to check whether the index is from start or end in C#?
- How to Create a Range From a Specified Start in C#?
- Finding the Start Index of the Specified Range in C#
- Finding all the Elements of a Range from Start to End in C#
- C# | Removing all nodes from LinkedList<T>
- C# | Removing first occurrence of specified value from LinkedList<T>
- Removing the object from the top of the Stack in C#
- C# | Removing the specified key entry from HybridDictionary
- C# | Removing all entries from the StringDictionary
- C# | Removing the specified element from the List
- C# | Removing all the elements from the List
- C# | Removing all entries from HybridDictionary
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.