LinkedList(T) Class
Represents a doubly linked list.
Assembly: System (in System.dll)
LinkedList(T) is a general-purpose linked list. It supports enumerators and implements the ICollection interface, consistent with other collection classes in the .NET Framework.
LinkedList(T) provides separate nodes of type LinkedListNode(T), so insertion and removal are O(1) operations.
You can remove nodes and reinsert them, either in the same list or in another list, which results in no additional objects allocated on the heap. Because the list also maintains an internal count, getting the Count property is an O(1) operation.
Each node in a LinkedList(T) object is of the type LinkedListNode(T). Because the LinkedList(T) is doubly linked, each node points forward to the Next node and backward to the Previous node.
Lists that contain reference types perform better when a node and its value are created at the same time. LinkedList(T) accepts a null reference (Nothing in Visual Basic) as a valid Value property for reference types and allows duplicate values.
If the LinkedList(T) is empty, the First and Last properties contain a null reference (Nothing in Visual Basic).
The LinkedList(T) class does not support chaining, splitting, cycles, or other features that can leave the list in an inconsistent state. The list remains consistent on a single thread. The only multithreaded scenario supported by LinkedList(T) is multithreaded read operations.
This type is not thread safe. If the LinkedList(T) needs to be accessed by multiple threads, you will need to implement their own synchronization mechanism.
A LinkedList(T) can support multiple readers concurrently, as long as the collection is not modified. Even so, enumerating through a collection is intrinsically not a thread-safe procedure. In the rare case where an enumeration contends with write accesses, the collection must be locked during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.