get index of array element without indexof csharp

Code Example - get index of array element without indexof csharp

                
                        for (let i = 0; i < arr.length; i++) {
    if (arr[i] === 6) {
      return i;
    }
  }
                    
                
 

csharp find index element array

                        
                                int[] arr = { 3, 6, 4, 1, 6, 8 };

// returns 1
Array.IndexOf(arr, 6);
                            
                        
 

Related code examples