Mid Collections

How would you remove an element from a LinkedList<T>?

Use Remove(value) to remove the first occurrence of the specified value, or

RemoveFirst() / RemoveLast() to remove from the start or end respectively.

numbers.Remove(10); // Removes the first node with value 10

numbers.RemoveFirst(); // Removes the first node

numbers.RemoveLast(); // Removes the last node

Follow:

More from C# Programming Tutorial

All questions for this course