| LinqHelperIndexOfT Method |
Returns the index of the first element in a sequence that satisfies the specified condition.
Namespace: DigitalRune.LinqAssembly: 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
)
<ExtensionAttribute>
Public Shared Function IndexOf(Of T) (
source As IEnumerable(Of T),
predicate As Func(Of T, Boolean)
) As Integer
public:
[ExtensionAttribute]
generic<typename T>
static int IndexOf(
IEnumerable<T>^ source,
Func<T, bool>^ predicate
)
[<ExtensionAttribute>]
static member IndexOf :
source : IEnumerable<'T> *
predicate : Func<'T, bool> -> int
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 See Also