Click or drag to resize

CollectionExtensionsIndexOfT(IEnumerableT, T) Method

Searches for the specified object and returns the zero-based index of the first occurrence within all items.

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 IndexOf<T>(
	this IEnumerable<T> collection,
	T item
)

Parameters

collection  IEnumerableT
The collection to search.
item  T
The object to locate. The value can be null for reference types.

Type Parameters

T
The type of elements in the list.

Return Value

Int32
The zero-based index of the first occurrence of item, 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