Method Find
Find(Predicate<T>)
Searches for the first value in the list that matches the specified predicate.
Declaration
public (WeakList<T>.Node Node, T Value)? Find(Predicate<T> match)
Parameters
| Type | Name | Description |
|---|---|---|
| Predicate<T> | match |
Returns
| Type | Description |
|---|---|
| (WeakList<T>.Node Node, T Value)? | The node and value of the first match, or null if no match was found. |
Remarks
This operation enumerates the list, so it takes O(n) time plus the cost of the predicate calls. Nodes added by other threads during the search are not considered.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | The list has been disposed. |
Find(T, IEqualityComparer<T>?)
Searches for the first value in the list that is equal to the specified value.
Declaration
public (WeakList<T>.Node Node, T Value)? Find(T value, IEqualityComparer<T>? comparer = null)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to search for. |
| IEqualityComparer<T> | comparer | The comparer to use to determine equality, or null to use the default comparer. |
Returns
| Type | Description |
|---|---|
| (WeakList<T>.Node Node, T Value)? | The node and value of the first match, or null if no match was found. |
Remarks
This operation enumerates the list, so it takes O(n) time plus the cost of the comparisons. Nodes added by other threads during the search are not considered.
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | The list has been disposed. |