> For the complete documentation index, see [llms.txt](https://gabriel-schade-cardoso.gitbook.io/tango/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gabriel-schade-cardoso.gitbook.io/tango/modules/collection/findindex.md).

# FindIndex

Returns the index of the first element in the collection that satisfies the given `predicate`.

| Parameters                                                   | Returns |
| ------------------------------------------------------------ | ------- |
| <p>Func\<T, bool> predicate</p><p>IEnumerable\<T> source</p> | int     |

## Exceptions

| Type                      | When                                                   |
| ------------------------- | ------------------------------------------------------ |
| InvalidOperationException | The predicate function returns false for all elements. |

## Usage

&#x20;**Find the index ofthe first even number**&#x20;

```csharp
//IEnumerable<int> source = { 1, 3, 5, 7, 8, 9, 10 }
bool result = source.FindIndex(value => value % 2 == 0);

//result = 4
```
