LinkedList<T>.Remove Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Removes the first occurrence of a node or value from the LinkedList<T>.
Overloads
Remove(LinkedListNode<T>) |
Removes the specified node from the LinkedList<T>. |
Remove(T) |
Removes the first occurrence of the specified value from the LinkedList<T>. |
Remove(LinkedListNode<T>)
- Source:
- LinkedList.cs
- Source:
- LinkedList.cs
- Source:
- LinkedList.cs
Removes the specified node from the LinkedList<T>.
public:
void Remove(System::Collections::Generic::LinkedListNode<T> ^ node);
public void Remove (System.Collections.Generic.LinkedListNode<T> node);
member this.Remove : System.Collections.Generic.LinkedListNode<'T> -> unit
Public Sub Remove (node As LinkedListNode(Of T))
Parameters
- node
- LinkedListNode<T>
The LinkedListNode<T> to remove from the LinkedList<T>.
Exceptions
node
is null
.
node
is not in the current LinkedList<T>.
Examples
For an example that includes this method, see the LinkedList<T> class.
Remarks
This method is an O(1) operation.
See also
Applies to
Remove(T)
- Source:
- LinkedList.cs
- Source:
- LinkedList.cs
- Source:
- LinkedList.cs
Removes the first occurrence of the specified value from the LinkedList<T>.
public:
virtual bool Remove(T value);
public bool Remove (T value);
abstract member Remove : 'T -> bool
override this.Remove : 'T -> bool
Public Function Remove (value As T) As Boolean
Parameters
- value
- T
The value to remove from the LinkedList<T>.
Returns
true
if the element containing value
is successfully removed; otherwise, false
. This method also returns false
if value
was not found in the original LinkedList<T>.
Implements
Examples
For an example that includes this method, see the LinkedList<T> class.
Remarks
This method performs a linear search; therefore, this method is an O(n
) operation, where n
is Count.