Method AddAfter
AddAfter(Node, T, bool)
Adds a value after the specified node.
Declaration
public WeakList<T>.Node? AddAfter(WeakList<T>.Node currentNode, T value, bool allowAfterRemovedNode)
Parameters
| Type | Name | Description |
|---|---|---|
| WeakList<T>.Node | currentNode | The node to add the value after. |
| T | value | The value to add. |
| bool | allowAfterRemovedNode | true to add the value near the position that |
Returns
| Type | Description |
|---|---|
| WeakList<T>.Node | The node that was added, or null if |
Remarks
This operation takes O(1) time unless currentNode has been removed from the list, in which case the list is searched backwards
from its former position for the nearest node that is still present and the value is added after that node.
Values added relative to a node that has been removed may end up in a different relative order than they would have had if the node were still in the list.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| InvalidOperationException |
|
| ObjectDisposedException | The list has been disposed. |
AddAfter(Node, T)
Adds a value after the specified node, or near the position the node occupied if it has been removed from the list.
Declaration
public WeakList<T>.Node AddAfter(WeakList<T>.Node currentNode, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| WeakList<T>.Node | currentNode | The node to add the value after. |
| T | value | The value to add. |
Returns
| Type | Description |
|---|---|
| WeakList<T>.Node | The node that was added. |
Remarks
This operation takes O(1) time unless currentNode has been removed from the list, in which case the list is searched backwards
from its former position for the nearest node that is still present and the value is added after that node.
Values added relative to a node that has been removed may end up in a different relative order than they would have had if the node were still in the list.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| InvalidOperationException |
|
| ObjectDisposedException | The list has been disposed. |