Language

LinkedList.Remove Method

Definition

Removes the first occurrence of a node or value from the LinkedList.

Overloads

Name Description
Remove(LinkedListNode)

Removes the specified node from the LinkedList.

Remove(T)

Removes the first occurrence of the specified value from the LinkedList.

Remove(LinkedListNode)

Source:
LinkedList.cs
Source:
LinkedList.cs
Source:
LinkedList.cs
Source:
LinkedList.cs
Source:
LinkedList.cs

Removes the specified node from the LinkedList.

public:
 void Remove(System::Collections::Generic::LinkedListNode ^ node);
public void Remove(System.Collections.Generic.LinkedListNode node);
member this.Remove : System.Collections.Generic.LinkedListNode<'T> -> unit
Public Sub Remove (node As LinkedListNode(Of T))

Parameters

node
LinkedListNode

The LinkedListNode to remove from the LinkedList.

Exceptions

node is null.

node is not in the current LinkedList.

Examples

For an example that includes this method, see the LinkedList class.

Remarks

This method is an O(1) operation.

See also

Applies to

Remove(T)

Source:
LinkedList.cs
Source:
LinkedList.cs
Source:
LinkedList.cs
Source:
LinkedList.cs
Source:
LinkedList.cs

Removes the first occurrence of the specified value from the LinkedList.

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.

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.

Implements

Examples

For an example that includes this method, see the LinkedList class.

Remarks

This method performs a linear search; therefore, this method is an O(n) operation, where n is Count.

See also

Applies to