Method GetNodeEnumerator
GetNodeEnumerator()
Returns an enumerator that iterates through the nodes in the list.
Declaration
public WeakList<T>.NodeEnumerator GetNodeEnumerator()
Returns
| Type | Description |
|---|---|
| WeakList<T>.NodeEnumerator |
Remarks
All nodes are enumerated, including nodes whose values have been garbage collected but have not yet been removed from the list, so Value may be null for some of them. Use GetEnumerator() to enumerate only the values that are still available.
Nodes added by other threads while enumerating may be included depending on timing. Use WasAddedDuringEnumeration to detect them, or AsEnumerable(bool, bool) to skip them.
Enumerating the entire list takes O(n) time. Each step takes O(1) time unless the current node was removed by another thread, in which case the enumerator searches forward for the next node that is still present.
GetNodeEnumerator(Node)
Returns an enumerator that iterates through the nodes in the list starting from the position of the specified node.
Declaration
public WeakList<T>.NodeEnumerator GetNodeEnumerator(WeakList<T>.Node startNode)
Parameters
| Type | Name | Description |
|---|---|---|
| WeakList<T>.Node | startNode |
Returns
| Type | Description |
|---|---|
| WeakList<T>.NodeEnumerator |
Remarks
startNode itself is not included in the enumeration. The first call to MoveNext() moves to the node
after it and the first call to MovePrevious() moves to the node before it.
All nodes are enumerated, including nodes whose values have been garbage collected but have not yet been removed from the list, so Value may be null for some of them. Use GetEnumerator() to enumerate only the values that are still available.
Nodes added by other threads while enumerating may be included depending on timing. Use WasAddedDuringEnumeration to detect them, or AsEnumerable(bool, bool) to skip them.
Enumerating the entire list takes O(n) time. Each step takes O(1) time unless the current node was removed by another thread, in which case the enumerator searches forward for the next node that is still present.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException |
|