AlgorithmsFindLastWhereT Method |
Finds the last item in a collection that satisfies the condition
defined by predicate.
Namespace: X3Platform.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic static T FindLastWhere<T>(
IEnumerable<T> collection,
Predicate<T> predicate
)
public:
generic<typename T>
static T FindLastWhere(
IEnumerable<T>^ collection,
Predicate<T>^ predicate
)
Parameters
- collection
- Type: System.Collections.GenericIEnumerableT
The collection to search. - predicate
- Type: SystemPredicateT
A delegate that defined the condition to check for.
Type Parameters
- T
[Missing <typeparam name="T"/> documentation for "M:X3Platform.Collections.Algorithms.FindLastWhere``1(System.Collections.Generic.IEnumerable{``0},System.Predicate{``0})"]
Return Value
Type:
TThe last item in the collection that matches the condition, or the default value for T (0 or null) if no
item that matches the condition is found.
RemarksIf the collection implements IList<T>, then the list is scanned in reverse until a
matching item is found. Otherwise, the entire collection is iterated in the forward direction.
If the default value for T could be present in the collection, and
would be matched by the predicate, then this method is inappropriate, because
you cannot disguish whether the default value for T was actually present in the collection,
or no items matched the predicate. In this case, use TryFindFirstWhere.
See Also