Items - Finding


Index method

starts searching at the beginning of the array

System.Array.Index 

If the value does not exist it returns -1.


LastIndexOf method

starts searching at the end of the array

System.Array.LastIndexOf 

If the value does not exist then it returns -1


BinarySearch method

This provides a faster search
Your array must be sorted first and therefore implement IComparable or a type that implements IComparer


int myArray[] = new int[] 

System.Array.BinarySearch(aiArray, 9)



© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext