Table of Contents

Class SynchronizedLinkedList<T>

Namespace
Ecng.Collections
Assembly
Ecng.Collections.dll

Represents a thread-safe linked list that provides synchronization for its operations.

public class SynchronizedLinkedList<T> : ISynchronizedCollection<T>, ISynchronizedCollection, ICollection<T>, IEnumerable<T>, IEnumerable

Type Parameters

T

The type of elements in the linked list.

Inheritance
SynchronizedLinkedList<T>
Implements
Inherited Members
Extension Methods

Constructors

SynchronizedLinkedList()

public SynchronizedLinkedList()

Properties

Count

Gets the number of nodes contained in the linked list.

public int Count { get; }

Property Value

int

First

Gets the first node of the linked list.

public virtual LinkedListNode<T> First { get; }

Property Value

LinkedListNode<T>

Last

Gets the last node of the linked list.

public virtual LinkedListNode<T> Last { get; }

Property Value

LinkedListNode<T>

SyncRoot

Gets the synchronization root object used to synchronize access to the linked list.

public SyncObject SyncRoot { get; }

Property Value

SyncObject

Methods

AddBefore(LinkedListNode<T>, LinkedListNode<T>)

Adds the specified new node before the specified existing node.

public virtual void AddBefore(LinkedListNode<T> node, LinkedListNode<T> newNode)

Parameters

node LinkedListNode<T>

The node before which the new node should be added.

newNode LinkedListNode<T>

The new node to add.

AddBefore(LinkedListNode<T>, T)

Adds a new node containing the specified value before the specified existing node.

public virtual void AddBefore(LinkedListNode<T> node, T value)

Parameters

node LinkedListNode<T>

The node before which the new node should be added.

value T

The value to add to the linked list.

AddFirst(LinkedListNode<T>)

Adds the specified new node at the start of the linked list.

public virtual void AddFirst(LinkedListNode<T> node)

Parameters

node LinkedListNode<T>

The new node to add.

AddFirst(T)

Adds a new node containing the specified value at the start of the linked list.

public virtual void AddFirst(T value)

Parameters

value T

The value to add to the linked list.

AddLast(LinkedListNode<T>)

Adds the specified new node at the end of the linked list.

public virtual void AddLast(LinkedListNode<T> node)

Parameters

node LinkedListNode<T>

The new node to add.

AddLast(T)

Adds a new node containing the specified value at the end of the linked list.

public virtual void AddLast(T value)

Parameters

value T

The value to add to the linked list.

Clear()

Removes all nodes from the linked list.

public void Clear()

Contains(T)

Determines whether the linked list contains the specified value.

public bool Contains(T item)

Parameters

item T

The value to locate in the linked list.

Returns

bool

true if the value is found in the linked list; otherwise, false.

CopyTo(T[], int)

Copies the elements of the linked list to an array, starting at a particular array index.

public void CopyTo(T[] array, int arrayIndex)

Parameters

array T[]

The one-dimensional array that is the destination of the elements copied from the linked list.

arrayIndex int

The zero-based index in array at which copying begins.

Find(T)

Finds the first node that contains the specified value.

public virtual LinkedListNode<T> Find(T value)

Parameters

value T

The value to locate in the linked list.

Returns

LinkedListNode<T>

The first node that contains the specified value, if found; otherwise, null.

FindLast(T)

Finds the last node that contains the specified value.

public virtual LinkedListNode<T> FindLast(T value)

Parameters

value T

The value to locate in the linked list.

Returns

LinkedListNode<T>

The last node that contains the specified value, if found; otherwise, null.

GetEnumerator()

Returns an enumerator that iterates through the linked list.

public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

An enumerator that can be used to iterate through the linked list.

Remove(LinkedListNode<T>)

Removes the specified node from the linked list.

public virtual void Remove(LinkedListNode<T> node)

Parameters

node LinkedListNode<T>

The node to remove.

Remove(T)

Removes the first occurrence of the specified value from the linked list.

public bool Remove(T item)

Parameters

item T

The value to remove from the linked list.

Returns

bool

true if the value was successfully removed; otherwise, false.

RemoveFirst()

Removes the node at the start of the linked list.

public virtual void RemoveFirst()

RemoveLast()

Removes the node at the end of the linked list.

public virtual void RemoveLast()