XEnumerableLastIndexOfTSource Method (IEnumerableTSource, FuncTSource, Boolean) |
Returns the position of the last element of source that verifies the specified predicate, or -1 if it is not found.
Namespace:
Linq.Extras
Assembly:
Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntaxpublic static int LastIndexOf<TSource>(
this IEnumerable<TSource> source,
Func<TSource, bool> predicate
)
<ExtensionAttribute>
Public Shared Function LastIndexOf(Of TSource) (
source As IEnumerable(Of TSource),
predicate As Func(Of TSource, Boolean)
) As Integer
[<ExtensionAttribute>]
static member LastIndexOf :
source : IEnumerable<'TSource> *
predicate : Func<'TSource, bool> -> int
Parameters
- source
- Type: System.Collections.GenericIEnumerableTSource
The sequence to search for a matching element. - predicate
- Type: SystemFuncTSource, Boolean
The predicate that is tested against each element.
Type Parameters
- TSource
- The type of the elements of source.
Return Value
Type:
Int32The zero-based index of the last element that verifies the predicate, or -1 if no element verifies the predicate.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableTSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also