| CollectionExtensionsFindIndexT Method |
Searches for an element that matches the conditions defined by the specified predicate,
and returns the zero-based index of the first occurrence within the entire
IEnumerableT.
Namespace:
TomsToolbox.Essentials
Assembly:
TomsToolbox.Essentials (in TomsToolbox.Essentials.dll)
Syntax public static int FindIndex<T>(
this IEnumerable<T> source,
Predicate<T> match
)
<ExtensionAttribute>
Public Shared Function FindIndex(Of T) (
source As IEnumerable(Of T),
match As Predicate(Of T)
) As Integer
Parameters
- source
- Type: System.Collections.GenericIEnumerableT
The collection containing the items to be searched. - match
- Type: SystemPredicateT
The PredicateT delegate that defines the conditions of the element to search for.
Type Parameters
- T
- The type of the items in the source collection.
Return Value
Type:
Int32
The zero-based index of the first occurrence of an element that matches the conditions
defined by
match, if found; otherwise, –1.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableT. 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