Click or drag to resize

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) Version: 2.21.0+44d18b541fc9419ec3c549350a832394661b2a4d
XMLNS for XAML: Not mapped to an xmlns.
Syntax
public static int FindIndex<T>(
	this IEnumerable<T> source,
	Predicate<T> match
)

Parameters

source  IEnumerableT
The collection containing the items to be searched.
match  PredicateT
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

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