"Jan" <ca*****@planet.nl> schrieb:
I've got the following array: FileIn(Counter)
How can i search the array for example "window"
\\\
Dim FileIn() As String = ...
Array.Sort(FileIn)
Dim Index As Integer = Array.BinarySearch(FileIn, "window")
///
'BinarySearch' will only make sense for a sorted array. For unsorted
arrays, a linear search would be the "best" choice, but this would mean that
the item you are looking for is compared to all items in the list until the
item is found. This algorithm has a runtime of O(n) for n items and thus is
very slow for large arrays. Nevertheless, it's faster than sorting and then
using binary search. Binary search makes sense if you are searching several
times.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>