Table of Contents

Method IndexOfFirst

Namespace
Alternet.Common
Assembly
Alternet.Common.v9.dll

IndexOfFirst<T>(IEnumerable<T>, Func<T, bool>)

Finds the index of the first item matching an expression in an enumerable.

public static int IndexOfFirst<T>(this IEnumerable<T> items, Func<T, bool> predicate)

Parameters

items IEnumerable<T>

The enumerable to search.

predicate Func<T, bool>

The expression to test the items against.

Returns

int

The index of the first matching item, or -1 if no items match.

Type Parameters

T