Click or drag to resize
DigitalRuneLinqHelperIndexOfT Method
Returns the index of the first element in a sequence that satisfies the specified condition.

Namespace: DigitalRune.Linq
Assembly: DigitalRune (in DigitalRune.dll) Version: 1.20.0.0 (1.20.1.14552)
Syntax
public static int IndexOf<T>(
	this IEnumerable<T> source,
	Func<T, bool> predicate
)

Parameters

source
Type: System.Collections.GenericIEnumerableT
A sequence of elements.
predicate
Type: SystemFuncT, Boolean
A predicate to test each element.

Type Parameters

T
The type of elements.

Return Value

Type: Int32
The zero-based index of the first element in the sequence that passed test; -1 if no element passed the test.

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).
Exceptions
ExceptionCondition
ArgumentNullExceptionsource or predicate is .
See Also