Collections Collections
Collections Collections
DocFX + Singulink = ♥

Search Results for

    Method AddBefore

    AddBefore(Node, T, bool)

    Adds a value before the specified node.

    Declaration
    public WeakList<T>.Node? AddBefore(WeakList<T>.Node currentNode, T value, bool allowBeforeRemovedNode)
    Parameters
    Type Name Description
    WeakList<T>.Node currentNode

    The node to add the value before.

    T value

    The value to add.

    bool allowBeforeRemovedNode

    true to add the value near the position that currentNode occupied if it has been removed from the list, or false to return null in that case.

    Returns
    Type Description
    WeakList<T>.Node

    The node that was added, or null if currentNode has been removed from the list and allowBeforeRemovedNode is false.

    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

    value is null.

    InvalidOperationException

    currentNode does not belong to this list.

    ObjectDisposedException

    The list has been disposed.

    AddBefore(Node, T)

    Adds a value before the specified node, or near the position the node occupied if it has been removed from the list.

    Declaration
    public WeakList<T>.Node AddBefore(WeakList<T>.Node currentNode, T value)
    Parameters
    Type Name Description
    WeakList<T>.Node currentNode

    The node to add the value before.

    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

    value is null.

    InvalidOperationException

    currentNode does not belong to this list.

    ObjectDisposedException

    The list has been disposed.

    © Singulink. All rights reserved.