C# List FindIndex with Examples – C# Programming Example
Collection List

C# List FindIndex with Examples

List FindIndex searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the List that starts at the specified index and contains the specified number of elements

Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire List<T>

Example 1: Get index number of given a number

Example 2: Get index number of given string

Example 3: We can start searching from a specific start and can give a custom range

Example 4: Find index number of an object (C# Findindex Predicate an object with Example)

Book class

Main:

Example 5: C# List FindIndex returns -1 if not found

 

 

 

 

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: