Skip to main content
Version: 4.1

SynchronizedLinkedList

Namespace: Wisej.Core

Assembly: Wisej.Framework (3.0.0.0)

Provides a thread-safe collection that contains objects of a type specified by the generic parameter as elements.

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

Constructors​

Instance memberSynchronizedLinkedList(collection, syncLock)​

Initializes a new instance of the SynchronizedLinkedList class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied and uses the specified syncLock object to synchronize its internal operations.

NameTypeDescription
collectionIEnumerable<T>The optional collection whose elements are copied to the new list.
syncLockObjectThe optional lock reference.

Properties​

Instance memberCount​

Int32: Gets the number of elements contained in the thread-safe collection.

Instance memberSyncRoot​

Object: Gets the object used to synchronize access to the thread-safe collection.

Methods​

Instance memberAdd(item)​

Adds a new item at the end of the LinkedList.

ParameterTypeDescription
itemTThe element to be added to the collection.

Instance memberAddAfter(item, newItem)​

Adds a new item after the specified item.

ParameterTypeDescription
itemTItem to find.
newItemTNew item to insert after item .

Instance memberAddBefore(item, newItem)​

Adds a new item before the specified item.

ParameterTypeDescription
itemTItem to find.
newItemTNew item to insert before item .

Instance memberAddFirst(item)​

Adds a new item at the start of the LinkedList.

ParameterTypeDescription
itemTThe element to be added to the collection.

Instance memberClear()​

Removes all items from the collection.

Instance memberContains(item)​

Determines whether the collection contains an element with a specific value.

ParameterTypeDescription
itemTThe object to locate in the collection.

Returns: Boolean. true if the element value is found in the collection; otherwise false.

Instance memberCopyTo(array, index)​

Copies the elements of the collection to a specified array, starting at a particular index.

ParameterTypeDescription
arrayT[]The destination Array for the elements copied from the collection.
indexInt32The zero-based index in the array at which copying begins.

Instance memberFind(match)​

Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire List.

ParameterTypeDescription
matchPredicate<T>The Predicate delegate that defines the conditions of the element to search for.

Returns: T. The first element that matches the conditions defined by the specified predicate, if found; otherwise, the default value.

Throws:

Instance memberFindAll(match)​

Retrieves all the elements that match the conditions defined by the specified predicate.

ParameterTypeDescription
matchPredicate<T>The Predicate delegate that defines the conditions of the elements to search for.

Returns: List<T>. A List containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty List.

Throws:

Instance memberForEach(action)​

ParameterTypeDescription
actionAction<LinkedListNode`1>

Instance memberGetEnumerator()​

Returns an enumerator that iterates through the synchronized collection.

Returns: IEnumerator<T>. An IEnumerator for objects of the type stored in the collection.

Instance memberRemove(item)​

Removes the first occurrence of a specified item from the collection.

ParameterTypeDescription
itemTThe object to remove from the collection.

Returns: Boolean. true if item was successfully removed from the collection; otherwise, false.

Instance memberRemoveAll(match)​

Removes all the elements that match the conditions defined by the specified predicate.

ParameterTypeDescription
matchPredicate<T>The Predicate delegate that defines the conditions of the elements to remove.

Returns: Int32. The number of elements removed from the List .

Throws: