Quickest way to find the string in 1 dimensional string array!
I have a queue 1 dimensional array of strings called 'queue' and I need
a fast way to search it. Once there is match, I don't need to search
any longer.
Currently I am using this code.
But I think it's too slow, because it runs through whole dimension.
I know this is trivial question, but is there any way to stop this
loop, or better way to search? I mean - FASTER?
This code is in vb.net. But I need a way to do this in C# as well.
Dim queue(1000000) As String
Dim lookfor as String
Dim count, isthere as Integer
While queue(count) <> Nothing
If queue(count) = lookfor Then
isthere = 1
End If
listing2 = count + 1
End While
If isthere = 1 then messagebox.show("Found it!")
else messagebox.show("Didn't Find it!")
End if
Please let me know.
Joe