Re: how to deal with a method that returns object array?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Sure... or you could do a foreach on the item collection...

VJ

"Ace" <Ace@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B69F444E-D974-4FFE-8C8E-7E573FFE33E3@xxxxxxxxxxxxxxxx
hi there,
i have a following method which returns array of object.

public myresult[] getSearch(string searchterm)
{
object[] res = ....some external method call
return ((myresult[]) (res[0]));
}

so my question is... how do i consume the above method? can i do the
following?
myresult[] res = getSearch("hello");

thanks...a


.



Relevant Pages

  • Re: [PHP] foreach() using current() strange beahvior
    ... that's expected as foreach moves the internal array pointer, ... When using the internal pointer just by calling current(so not moving ... Unless the array is referenced, foreach operates on a copy of the ...
    (php.general)
  • Re: a question about for and foreach
    ... foreach (@array) { ... why @array are changed after this foreach loop!!! ... The "foreach" loop iterates over a normal list value and sets the ... If any element of LIST is an lvalue, you can modify it by modifying ...
    (perl.beginners)
  • Re: safe to delete elements of array in foreach
    ... I agree with Jon on this one. ... I make it a habit not to delete entries in a foreach() loop. ... build an array of keys I want to delete, and after the loop ends, delete ... I don't know whether an operation like this is guaranteed to work in PHP ...
    (comp.lang.php)
  • Re: [PHP] Foreach
    ... The problem I am having is getting both to update the table in MySQL. ... echo "$t"; ... foreach { ... // foreach expects an array, ...
    (php.general)
  • Re: safe to delete elements of array in foreach
    ... (normally this is not the case but not sure in php) ... I make it a habit not to delete entries in a foreach() loop. ... build an array of keys I want to delete, and after the loop ends, ...
    (comp.lang.php)