c# get index of item in array code example
Example 1: c# find index element array
int[] arr = { 3, 6, 4, 1, 6, 8 };
// returns 1
Array.IndexOf(arr, 6);
Example 2: c# get index of item in list
Array.IndexOf(arrName, searchingFor)
int[] arr = { 3, 6, 4, 1, 6, 8 };
// returns 1
Array.IndexOf(arr, 6);
Array.IndexOf(arrName, searchingFor)