Class RadLinkedList<T>
Represents a linked list collection that allows for efficient insertion and removal of elements.
Inheritance
Namespace: Telerik.Windows.Documents.DocumentStructure
Assembly: Telerik.Windows.Controls.RichTextBox.dll
Syntax
public class RadLinkedList<T> : Object, ICollection<T>, IEnumerable<T>, IEnumerable, ICollection
Type Parameters
T
|
Constructors
RadLinkedList()
Declaration
public RadLinkedList()
Properties
Count
Gets the number of elements contained in the RadLinkedList.
Declaration
public int Count { get; }
Property Value
System.Int32
The number of elements in the RadLinkedList. |
First
Gets the first node in the list.
Declaration
public RadLinkedListNode<T> First { get; }
Property Value
RadLinkedListNode<T>
|
IsEmpty
Gets a value indicating whether the linked list is empty.
Declaration
public bool IsEmpty { get; }
Property Value
System.Boolean
|
IsReadOnly
Gets a value indicating whether the linked list is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
System.Boolean
true if the linked list is read-only; otherwise, false. |
Last
Gets the last node in the list.
Declaration
public RadLinkedListNode<T> Last { get; }
Property Value
RadLinkedListNode<T>
|
Methods
Add(T)
Adds a new element of type T to the end of the linked list.
Declaration
public void Add(T item)
Parameters
T
item
The item to be added to the linked list. |
AddAfter(RadLinkedListNode<T>, T)
Adds a new node containing the specified value after the specified node in the linked list.
Declaration
public RadLinkedListNode<T> AddAfter(RadLinkedListNode<T> node, T value)
Parameters
RadLinkedListNode<T>
node
The node after which the new value will be inserted. |
T
value
The value to be added to the linked list. |
Returns
RadLinkedListNode<T>
Returns the newly added node. |
AddAfter(RadLinkedListNode<T>, RadLinkedListNode<T>)
Inserts a new node after a specified existing node in the linked list.
Declaration
public RadLinkedListNode<T> AddAfter(RadLinkedListNode<T> node, RadLinkedListNode<T> newNode)
Parameters
RadLinkedListNode<T>
node
The existing node after which the new node will be added. |
RadLinkedListNode<T>
newNode
The new node to be inserted into the linked list. |
Returns
RadLinkedListNode<T>
Returns the newly added node. |
AddBefore(RadLinkedListNode<T>, T)
Inserts a new node containing the specified value before the specified existing node in the linked list.
Declaration
public RadLinkedListNode<T> AddBefore(RadLinkedListNode<T> node, T value)
Parameters
RadLinkedListNode<T>
node
The existing node before which the new node will be inserted. |
T
value
The value to be stored in the newly created node. |
Returns
RadLinkedListNode<T>
Returns the new node that has been added to the linked list. |
AddBefore(RadLinkedListNode<T>, RadLinkedListNode<T>)
Inserts a new node before the specified node in the linked list.
Declaration
public RadLinkedListNode<T> AddBefore(RadLinkedListNode<T> node, RadLinkedListNode<T> newNode)
Parameters
RadLinkedListNode<T>
node
The node before which the new node will be inserted. |
RadLinkedListNode<T>
newNode
The new node to insert into the list. |
Returns
RadLinkedListNode<T>
Returns the newly added node if the insertion is successful; otherwise, returns null. |
AddFirst(T)
Adds a new element at the beginning of the linked list.
Declaration
public RadLinkedListNode<T> AddFirst(T value)
Parameters
T
value
The item to be added to the beginning of the linked list. |
Returns
RadLinkedListNode<T>
Returns the new node that has been added to the linked list. |
AddFirst(RadLinkedListNode<T>)
Adds a new node containing the specified value to the start of the linked list.
Declaration
public RadLinkedListNode<T> AddFirst(RadLinkedListNode<T> node)
Parameters
RadLinkedListNode<T>
node
The node to be added to the beginning of the linked list. |
Returns
RadLinkedListNode<T>
Returns the new node that has been added to the linked list. |
AddLast(T)
Adds a new element to the end of the linked list.
Declaration
public RadLinkedListNode<T> AddLast(T value)
Parameters
T
value
The value to be added to the end of the linked list. |
Returns
RadLinkedListNode<T>
Returns the new node that has been added to the linked list. |
AddLast(RadLinkedListNode<T>)
Adds a new node containing the specified value to the end of the linked list.
Declaration
public RadLinkedListNode<T> AddLast(RadLinkedListNode<T> node)
Parameters
RadLinkedListNode<T>
node
The node to be added to the end of the linked list. |
Returns
RadLinkedListNode<T>
Returns the new node that has been added to the linked list. |
AddRangeAfter(RadLinkedListNode<T>, RadLinkedListNode<T>, RadLinkedListNode<T>)
Adds a range of nodes after a specified node in the linked list.
Declaration
public void AddRangeAfter(RadLinkedListNode<T> node, RadLinkedListNode<T> rangeStartNode, RadLinkedListNode<T> rangeEndNode)
Parameters
RadLinkedListNode<T>
node
The node after which the range will be added. |
RadLinkedListNode<T>
rangeStartNode
The node that marks the end of the range to be added. |
RadLinkedListNode<T>
rangeEndNode
The starting node of the range to be added. |
AddRangeBefore(RadLinkedListNode<T>, RadLinkedListNode<T>, RadLinkedListNode<T>)
Adds a range of nodes before a specified node in the linked list.
Declaration
public void AddRangeBefore(RadLinkedListNode<T> node, RadLinkedListNode<T> rangeStartNode, RadLinkedListNode<T> rangeEndNode)
Parameters
RadLinkedListNode<T>
node
The starting node of the range to be added. |
RadLinkedListNode<T>
rangeStartNode
The ending node of the range to be added. |
RadLinkedListNode<T>
rangeEndNode
The node before which the range will be added. |
Clear()
Removes all elements from the linked list, resetting its count to zero.
Declaration
public void Clear()
Remarks
After calling this method, the linked list will be empty, and any references to the removed elements will be discarded.
Contains(T)
Determines whether the linked list contains a specific value.
Declaration
public bool Contains(T item)
Parameters
T
item
The value to locate in the linked list. |
Returns
System.Boolean
True if the linked list contains an element with the specified value; otherwise, false. |
CopyTo(T[], Int32)
Copies the elements of the linked list to an array, starting at a specified array index.
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
T[]
array
The one-dimensional array that is the destination of the elements copied from the linked list. |
System.Int32
arrayIndex
The zero-based index in the array at which copying begins. |
GetEnumerator()
Provides an enumerator for iterating through the elements of the linked list.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
System.Collections.Generic.IEnumerator<T>
An enumerator that can be used to iterate through the linked list. |
MoveNodes(RadLinkedList<T>, RadLinkedListNode<T>)
Moves nodes from one linked list to another linked list.
Declaration
public void MoveNodes(RadLinkedList<T> fromList, RadLinkedListNode<T> fromNode)
Parameters
RadLinkedList<T>
fromList
The source linked list from which nodes will be moved. |
RadLinkedListNode<T>
fromNode
The destination linked list to which nodes will be moved. |
MoveNodes(RadLinkedList<T>, RadLinkedListNode<T>, RadLinkedListNode<T>)
Moves nodes from one linked list to another linked list.
Declaration
public void MoveNodes(RadLinkedList<T> fromList, RadLinkedListNode<T> fromNode, RadLinkedListNode<T> toNode)
Parameters
RadLinkedList<T>
fromList
The linked list from which nodes will be moved. |
RadLinkedListNode<T>
fromNode
The node that will be moved from the source list. |
RadLinkedListNode<T>
toNode
The linked list to which the nodes will be moved. |
Remove(T)
Removes the first occurrence of a specified object from the linked list.
Declaration
public bool Remove(T item)
Parameters
T
item
The object to remove from the linked list. The value can be null for reference types. |
Returns
System.Boolean
true if the object is successfully removed; otherwise, false. This method also returns false if the object was not found in the linked list. |
Remove(RadLinkedListNode<T>)
Removes the specified node from the linked list.
Declaration
public void Remove(RadLinkedListNode<T> node)
Parameters
RadLinkedListNode<T>
node
The node to be removed from the linked list. |
RemoveFirst()
Removes the first element from the linked list.
Declaration
public void RemoveFirst()
RemoveLast()
Removes the last element from the linked list.
Declaration
public void RemoveLast()
RemoveRange(RadLinkedListNode<T>, RadLinkedListNode<T>)
Removes a range of nodes from the linked list, beginning at the specified start node and ending at the specified end node.
Declaration
public void RemoveRange(RadLinkedListNode<T> rangeHead, RadLinkedListNode<T> rangeTail)
Parameters
RadLinkedListNode<T>
rangeHead
The starting node of the range to be removed. |
RadLinkedListNode<T>
rangeTail
The ending node of the range to be removed. |