Sorry to be dense, from reading remarks it sounds like IndexOf searches the
complete array, then returns the index of the first occurence, there for the
loop is more efficient any ways. Is that what you were trying to convey with
your suggestion of reading remarks?
"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "DazedAndConfused" <(E-Mail Removed)> schrieb:
>> Is the only way to searh for a value in a multi dimensional array is with
>> a loop?
>
> Yes... When using jagged arrays you can use consecutive calls to
> 'Array.IndexOf' for the sub arrays.
>
>> Is a loop any less efficient then IndexOf in a single dimensional array?
>
> In general no. I suggest to read the "Remarks" section of the
> 'Array.IndexOf' method, which gives information about the implementation
> of this method.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>
|